When i upload the image(4480px X 5808px)size 757KB getting error And
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8192 bytes) in /home/dygnmuu4/public_html/cuisinecanvas.com/application/controllers/Food_blogger.php on line 128
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /home/dygnmuu4/public_html/cuisinecanvas.com/system/core/Exceptions.php on line 1
when i try to upload image(4480px X 4368px)size 4.2MB Successfully uploaded
I also set upload_max_filesize = 64M to php.ini
PHP code:
list($w, $h) = getimagesize($tmpfile);
if ($w < $h){
/* line: 128 */ $image = imagecrop($image, array("x" => 0, "y" => ($h - $w) / 2, "width" => $w, "height" => $w));
}else if ($h < $w){
$image = imagecrop($image, array("x" => ($w - $h) / 2, "y" => 0, "width" => $h, "height" => $h));
}
2
Answers
try this
put in top your view_code, or
if in this case you use ubuntu and php5.6, change file php.ini
/etc/php/5.6/apache2/php.ini then faind text memory_limit change value to -1,
hopes this helps
On the server also increase the
upload_max_filesize
in cpannel->selectphpversion->switchtophpoptions->upload_max_filesize.