Closed (won't fix)
Project:
Drupal core
Version:
5.7
Component:
other
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
20 Feb 2008 at 04:53 UTC
Updated:
19 Sep 2011 at 11:34 UTC
What should I do about this warning? Is it a php, image module, or picture problem?
warning: imagecolorsforindex(): Color index 49 out of range in /var/www/html/includes/image.inc on line 251.
Comments
Comment #1
drewish commentedwhat are you doing when you see it? using the color module?
Comment #2
Eudaimonius commentedI changed the thumbnail size (?q=admin/settings/image).
"* Changes to the images sizes mean that the derivative images will need to be regenerated."
"* The configuration options have been saved."
Upon viewing a page containing thumbnails:
"The derivative images for picture_xyz have been regenerated."
"warning: imagecolorsforindex(): Color index 49 out of range in /var/www/html/includes/image.inc on line 251."
Comment #3
batigolixmaybe because of (animated) gifs: http://drupal.org/node/218045#comment-862584
Comment #4
jfall commentedNo, I don't think so.
I'm getting exactly this error - but I don't use image.module - the error occurs in image.inc in core (so I moved this issue)
I'm getting the following error (in log):
function.imagecolorsforindex: Color index 255 out of range in /home2/lasqica/public_html/includes/image.inc on line 251.
Here's the relevant code:
I checked my image - it DOES use color 255 for transparency (this is the highest index in image), which is correctly returned from
imagecolortranparent().I'm guessing this is a PHP issue? I'm running PHP 5.2.5 Anyone heard of it before? Is there a workaround / patch?
Any ideas? Thanks.
Comment #5
ali27 commentedint $index=imagecolortransparent ( resource $image [, int $color ] )
Sets the transparent color in the given image .
image
An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().
array imagecolorsforindex ( resource $image , int $index )
Gets the color for a specified index
try to put a $index less than 255
for more information about php functions go to php.net there you can found all you want
http://www.php.net/manual/en/function.imagecolorsforindex.php
Comment #6
ainigma32 commentedSolution provided. Setting to fixed.
Feel free to reopen if you think that is wrong.
- Arie
Comment #8
AppleBag commentedI'm not quite clear on the solution, can someone explain it a bit more? thanks
Comment #9
AppleBag commentedAnyone? Getting a ton of these in watchdog.
Comment #10
AppleBag commentedBueller ..?
Buelllller ... ?
Comment #11
j0rd commentedSame issue here. Unsure of fix.
Comment #12
drewish commentedi need to see one of these images.
Comment #13
AppleBag commentedhttp://geekdrop.com/files/pictures/picture-3.gif
Comment #14
drewish commentedthe problem is that gd can't resize animated gifs so there's not much that can be done here.
Comment #15
AppleBag commentedIs there any way to suppress the error in that case, so it doesn't fill the watchdog with tons of the error messages? As far as I can tell, other than that error message, nothing else is affected.
Comment #16
j0rd commentedHere's the one it happens for me on: http://www.newswire.ca/images/companies/logo_6828.gif
@AppleBag. You could append @ in front of the function I believe. I think that's PHP's lame/awesome way of suppressing errors.
http://us.php.net/operators.errorcontrol
Comment #17
Dr Trichome commentedHi,
I had a similar error using Drupal 6, using imagepicker module. If I uploaded a gif, I would get that error (it was not an animated gif). I solved the problem by removing the alpha from my gif. Note: I use a mac. I opened the image file in Preview, went to file->save as..., and in the dialog box that comes up, I unchecked the box for alpha. Then saved the gif and it uploaded just fine--no more errors. Alternatively, I guess you could save the file as a jpg. I hope this helps.
Comment #18
ricky1006 commentedI have the same problem. I solved by removing the transparency of the image and the error disappears.