1

I have this information about my servers php.ini values set in it.

max_execution_time  30
memory_limit    256M
post_max_size   64M

When I try to make thumbnail of image its gives me error as follows...

Fatal error: Out of memory (allocated 27787264) (tried to allocate 15054336 bytes)

in......

image size is 8.81 MB.

This is my code-

$sizee = @getimagesize($newfilename);

        switch ($sizee['mime']) {
            case "image/jpeg" :
            $srcImage = imagecreatefromjpeg($old);
            break;
            case "image/png":
            $srcImage = imagecreatefrompng($old);
            break;
            case "image/gif":
            $srcImage = imagecreatefromgif($old);
            break;
        }
j0k
  • 22,600
  • 28
  • 79
  • 90
John
  • 1,035
  • 2
  • 9
  • 15
  • 1
    do phpinfo() see if memory_limit displaying correctly ? – GBD Oct 13 '12 at 10:57
  • See: [PHP Fatal error: Out of memory...](http://stackoverflow.com/questions/6314733/php-fatal-error-out-of-memory-allocated-80740352-tried-to-allocate-12352-byt) which helps people understand how memory limits come about with GD – nickhar Oct 13 '12 at 11:00
  • @GBD yes that is what get from phpinfo() function... – John Oct 13 '12 at 11:01
  • You are you are using 2 different images `$newfilename` and `$old` ??? What is really happening here – Baba Oct 13 '12 at 11:02
  • Its also give same error when your execution is infinite so check your code if you have used any loop like for,while etc in your code then make sure about it. – Hkachhia Oct 13 '12 at 11:03
  • More of your code would be better ... – Baba Oct 13 '12 at 11:05
  • @Baba, I am just doing different varible assignment for different use. `$old = LOCAL_FOLDER . $newfilename; $newfilename = LOCAL_FOLDER . $newfilename;` – John Oct 13 '12 at 11:09
  • @Harry i have just use 1 for loop to fetch the images from db ,nothing else .. :( – John Oct 13 '12 at 11:11
  • @user1743213 Ok but I have already faced this problem that I have told you – Hkachhia Oct 13 '12 at 11:31

0 Answers0