PNG upload ERROR

See all posts Reply

PNG upload ERROR new!
by Jared Mitchell, 16 years, 11 months ago
Came across this error while testing the upload class.

"I was having a terrible time with the imagecreatefrompng function as it was working perfectly for one image and not at all for another. After many hours of frustration, I discovered that the problem was the image size (number of pixels). It appears that the maximum number of pixels this function will process is 1,040,000. So, be sure that the pixel resolution of the image (eg. 1040 x 1000) does not exceed this value."

The above was taken from php.net.

This causes an issue on line 2884 of the class.upload.php

my fix was to replace the line with additional size checks
if ( (!function_exists('imagecreatefrompng')) || ($this->image_src_x > '950') || ($this->image_src_y > '750') ) 

While not perfect it does stop the problem of having the script exit without returning an error.

Regards,
JaredReply
Re: PNG upload ERROR new!
by colin, 16 years, 11 months ago
You are in fact running out of memory. The fix you added is not good, because it relies on your memory setting, and will not be appropriate for other configurations.

On the same php.net page, read the second comment above the one you mentioned.

See this thread

Try to raise your local memory to 20M, 32M or more.

You can add this in your script:
ini_set ( "memory_limit", "20M")

Or in a .htaccess file:
php_value memory_limit 20M
Reply