JamesHeinrich / phpThumb

phpThumb() - The PHP thumbnail generator
Other
315 stars 98 forks source link

Can't keep GIFs animated after compression #151

Open zeid20000 opened 4 years ago

zeid20000 commented 4 years ago

Hi, I'm unable to keep GIFs animated after compressing them although ImageMagick is already installed. Here is what I'm doing:

$phpThumb->resetObject();
$phpThumb->setSourceData(file_get_contents('mydir/'.date('Y',$up_ts).'/'.date('m',$up_ts).'/'.$up_old_name));
$output_filename = 'mydir/'.date('Y',$up_ts).'/'.date('m',$up_ts).'/'.$up_new_name;
$phpThumb->setParameter('q', $img_quality);
if($phpThumb->GenerateThumbnail()) {
    if($phpThumb->RenderToFile($output_filename)) {
    } else {
    }
    $phpThumb->purgeTempFiles();
} else {
}
ggppdk commented 4 years ago

I also have problem with creating animated gif thumbnails I compiled and used latest source of ImageMagick, but it did not help

Is it because phpThumb , uses

which only supports reading 1st frame

https://github.com/JamesHeinrich/phpThumb/blob/master/phpthumb.class.php#L1642

https://www.php.net/manual/en/function.imagecreatefromgif.php

arturmamedov commented 1 year ago

Yes i think its impossible with this library