imagecreatefromjpeg + Out of memory problem

前端 未结 2 1644
执笔经年
执笔经年 2021-01-21 03:10

Hello All i have following ini variable set in phpini file.

max_execution_time 50000

memory_limit 40M

post_max_size 8M

When i try to make thumbna

相关标签:
2条回答
  • 2021-01-21 03:16

    What is the resolution of your 700kb image? It doesn't really matter how big the original .JPG is. If it's a very "simple" image, it could literally be 10,000 x 10,000 pixels. When it's loaded/uncompressed by PHP, those pixels will require 10k x 10k x 3 = 286 megabytes (10x squared times 3 for each red/green/blue component value).

    And of course, you say you've set memory limit to 40M, but you've run out of memory at just 29.25 meg. Could be that there's an override somewhere in the setup, perhaps in a site-specific web server .conf file, or a .htaccess, which is setting a lower limit than 40M.

    0 讨论(0)
  • 2021-01-21 03:20

    Your problem is not that single call to imagecreatefromjpeg() but memory that you have allocated earlier. After all, the allocation fails with a memory request for only ~14kB.

    Maybe you created images before in the same script without releasing their memory with imagedestroy() or you have another memory problem. In the latter case you could use a debugging tool (e.g. webgrind) to find the memory hog.

    0 讨论(0)
提交回复
热议问题