Getting this error when trying to load image into memory...
Allowed memory size of 10485760 bytes exhausted (tried to allocate 18048 bytes)
//attempt to open image
ini_set('memory_limit', '10M');
if($im = imagecreatefromjpeg($_GET['imgname'])) {
//See if there is a width or height constraint
if (isset($_GET['restraint'])) {
$constr = $_GET['restraint'];
if ($constr == "width") {
if (imagesx($im) > imagesy($im)) {
$im = imagerotate($im, 90, 0);
}
} elseif ($constr == "height") {
if (imagesy($im) > imagesx($im)) {
$im = imagerotate($im, 90, 0);
}
}
}
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
}
Any ideas?
Edit:
memory_get_usage = 125768 memory_get_peak_usage = 127016