phpThumb icon indicating copy to clipboard operation
phpThumb copied to clipboard

Can't keep GIFs animated after compression

Open zeid20000 opened this issue 4 years ago • 2 comments

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 {
}

zeid20000 avatar Apr 24 '20 09:04 zeid20000

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

  • PHP method imagecreatefromgif() ?

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

ggppdk avatar May 15 '20 08:05 ggppdk

Yes i think its impossible with this library

arturmamedov avatar Nov 09 '22 11:11 arturmamedov