0

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));
}
Pankss
  • 29
  • 5
  • 1
    Possible duplicate of [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – Alex Jun 22 '19 at 12:16

2 Answers2

0

try this

ini_set('memory_limit','-1');

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

Hip Hura
  • 143
  • 8
  • check you file .htaccess, try to add this code php_value memory_limit -1; or php_value memory_limit 256M; – Hip Hura Jun 22 '19 at 14:53
  • check this : [link](https://stackoverflow.com/questions/4096582/allowed-memory-size-of-x-bytes-exhausted). – Hip Hura Jun 22 '19 at 15:40
0

On the server also increase the upload_max_filesize in cpannel->selectphpversion->switchtophpoptions->upload_max_filesize.

Danial212k
  • 130
  • 1
  • 10