Extract stuck in an infinite loop
ArthurGuy opened this issue · comments
It gave me #808080 ("missing" pixels color, dunno why) after 37 seconds. I think this image shouldn't be processed directly because it has too many pixels.
My extraction routine generates a 200px by 200px image from the original and then runs this through the colour extractor.
The smaller version thats generated also ends up corrupted and breaks the extractor.
This should be the actual file run through the colour extractor, hopefully it will generate the same error.
I don't get any error (#808080 again after 200ms). There must be a difference between our libgd and php-gd versions. Which one are you using?
These are the commands I am running that get stuck.
$image = \ColorExtractor::loadJpeg("https://s3-eu-west-1.amazonaws.com/photoshr-tmp/ee36cd57345bf78fd37a0f2783530c4b.jpg");
$palette = $image->extract(6);
print_r($palette);
I am using gd version 2.0.34 on my local machine.
Its also failing when run on fortrabbit's hosting
I get #808080 again so it's definitively a difference between libgd 2.0 and 2.1.
I don't know how to detect nor handle corrupted images with php-gd so it's probably best for you to update.
Thanks for looking into this.
Over to the hosting company now!
Maybe you can check for corrupted images with imagecreatefromjpeg
return value for now?
Sorry I cannot test this.
Apparently Fortrabbit are running gd 2.1 so this looks like another issue.
I have disabled the colour pallet now now and will revisit in the future when I have more time.