Long time ago I had a question about how to extract / view image field in mssql using php and thanks for BenMorel who gave me the correct codes.
The code is like this :-
// change to suit your needs
$tempFolder = '/tmp/';
mssql_connect('server','username','password') or die('error connecting to db server');
mssql_select_db('database') or die('error selecting db');
// load photo
$query = "select photo from photograph limit 1";
$res = mssql_query($query) or die('error querying');
$row = mssql_fetch_assoc($res);
// write temporary file for getimagesize()
$tempFile = $tempFolder . '/' . md5(uniqid(rand()));
$fp = fopen($tempFile, 'wb') or die('Error writing temp file');
fwrite($fp, $row['photo']) or die('error writing');
// get infos from image file
$info = getimagesize($tempFile);
// delete temp file
unlink($tempFile) or die('error deleting');
// send to browser
header('Content-Type: ' . $info['mime']);
This used to work fine and it was showing the complete picture .. lately I checked the code again and strangely it started showing a small part of the picture ( like if there is a picture of a complete head it would show only the head up to eyes part ) .. maybe they changed the picture type that they used to store in the image field ?
How can I tell the above code to show the complete image field regardless to its type or its size ?
Greatful if you can help.
Note: - I posed this message earlier but no one suggested any solutions.