When using ImageCreateFromJPEG (e.g. if I want to resize an image) an uncompressed version of the image is stored in the memory. As a consequence, a 100 kb image (dimensions 5000×5000) may consume the entire memory_limit and therefore be rejected (Fatal error: Allowed memory size of xxxxxxxx bytes exhausted…), while a 900 kb image (1000×1000) may upload without any problems.
The easy solution would be to increase memory_limit etc. in php.ini, but if we are looking at really large dimensions this is not always a good solution. It would consume a lot of memory and could eventually slow down the server.
I use ini_set(‘memory_limit’, ‘-1’);, though.