For some reason I get the following error when I try to pull down an image larger then 40kb from a MSSQL database.
<br />
<b>Fatal error</b>: Out of memory (allocated 265027584) (tried to allocate 528482304 bytes) in <b>/home/public_html/test/image.php</b> on line <b>31</b><br />
Here is the code that I am using.
<?php
header("Content-type: image/jpeg;" );
$myServer = "";
$myUser = "";
$myPass = "";
$myDB = "";//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT * ";
$query .= "FROM Pictures ";
$query .= "WHERE (ID = ".$_REQUEST[P].")";//execute the SQL query and return records
$result = mssql_query($query);$numRows = mssql_num_rows($result);
//display the results
while($row = mssql_fetch_array($result))
{$image = imagecreatefromstring(gzinflate($row["Picture"]));
imagejpeg($image, NULL, 75);
imagedestroy($image);
}
//close the connection
mssql_close($dbhandle);
?>
I increased the memory_limit to 900mb and it still gives me that error.
Anything that I can do to fix it?