PHP Notices generated by imagecolorat() on line 3864

See all posts Reply

PHP Notices generated by imagecolorat() on line 3864 new!
by Matt Cassarino, 16 years, 1 month ago
Hi Colin,

First off, thanks for this amazing upload script. I've been using it for over a year and it is by far the best PHP script that I've found for managing file uploads.

When uploading this file (http://supint.com/test/upload-class/home-page-concept.jpg) I use the 0.25 upload class to resize it to 546x450 pixels. The upload and resize work fine, but I'm getting really weird PHP Notices:

"PHP Notice: imagecolorat() [function.imagecolorat: 546,0 is out of bounds ... class.upload.php on line 3864"

My server ends up spitting out this Notice around 700 times per upload, for each pixel:
546,0
546,1
546,2
546,3
etc etc all the way up to 546,449 and also for the pixel range 145,0 up to 145,119. Weird!

This group of Notices does not show for all uploads, which makes it that much more confusing.

Here is another image file that generates the Notices, this time for the range of 337,0 to 337,449. http://supint.com/test/upload-class/sunflowers.jpg (note - this image is resized to be 337,450 and uploads just fine.)

The 0.24 version of your upload class doesn't cause these Notices, so I've ended up using that for now. But I'd like to use the 0.25 version. Thought you'd like to know about this possible bug and I would sure like to know if it's just me / my server or something else going on here.

Thanks,
Keep up the great work!

Matt
Seattle, WA (USA)Reply
Re: PHP Notices generated by imagecolorat() on line 3864 new!
by colin, 16 years, 1 month ago
I can't recreate the issue with 0.25. The line of code that gives an error shouldn't have values out of bound. According to the line number you provided, the bug happens when preparing the image to be saved as BMP. You are saving your image as BMP?

What versions of PHP and GD are you using? What is the log that you get from the class when you have errors?Reply