I get this warning:

warning: imagecolorsforindex() [function.imagecolorsforindex]: Color index 48 out of range in D:\xampp\htdocs\drupal-p3-bb\includes\image.gd.inc on line 108.

when I upload the attached image.

1. CCK version: 2.2
2. imagefield version: 6.x-3.0-beta3
3. permissions for your tmp and files directory: public
4. download method (public or private files): public
5. imagefield configuration: required, max and min sizes set.

Comments

quicksketch’s picture

Title: warning from imagecolorsforindex » Warning from imagecolorsforindex with Animated GIF

Does this problem only exist with the attached image? What are your max and min size set to?

joachim’s picture

Nope, my designer reports the same error with another, similar image.

I set max and min to 210x210 to force this exact size image.

quicksketch’s picture

The function in image.gd.inc that calls imagecolorsforindex() is image_gd_resize(), which had me worried that your image was being resized for some reason, despite being exactly the same size as the required dimensions.

Turns out the required size check is just fine, it's the creation of the thumbnail that's causing this error. Since Drupal core can't resize animated GIFs properly, our only option might be to check if ImageAPI is available and use it for resizing if available. Though I'm not sure it can resize animated GIFs either.

quicksketch’s picture

Version: 6.x-3.0-beta3 » 6.x-3.0-rc1
Status: Active » Fixed
StatusFileSize
new1.98 KB

Well a simple solution to this is to simply suppress the errors. The image generation is still successful if image_resize() returns TRUE (which it seems to), and I've added separate messages if the resizing fails completely.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.