Trying to resize a set of large images in PHP

Well, my PHP script terminates if I try to resize a set of big images. I use WideImage to resize images. Each image in a set is weighted around 10M. When I start my PHP script it terminates halfway and only several images from a collection have been resized. So, maybe it’s some limitation.. I am stating to find something in php.ini that starts with words “max..”. Wow! I’ve found memory_limit it’s a maximum amount of memory a script may consume. The default value of this setting is 128M. I set the new value of 500M for test. OK! My script has resized all the images! The amout of memory that is allocated is 140M, so it’s greater then a default value of 128M.

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
; memory_limit = 128M
memory_limit = 256M

I also log a running time of my script and it’s 28 seconds. In the php.ini the default value of maximum execution time is 30 seconds. To be on the safe side, I increased it to 60 seconds.

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
; max_execution_time = 30
max_execution_time = 60

One Response to “Trying to resize a set of large images in PHP”