I am using GD to manipulate images in PHP, based on this code
<?php
/**
Función para detectar si una imagen es animación
*/
function is_ani($filename) {
if(!($fh = @fopen($filename, 'rb')))
return false;
$count = 0;
while(!feof($fh) && $count < 2) {
$chunk = fread($fh, 1024 * 100);
$count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00(\x2C|\x21)#s', $chunk, $matches);
}
fclose($fh);
return $count > 1;
}
?>
I intend to separate the frames inside the GIF (I can even use this library ) and save them in WEBP format .
How can I assemble/create an animated image in WEBP format using GD in PHP?
--EDITED--
PHP version:
PHP 7.2.4 (built: Apr 25 2018 12:05:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
gd_info:
#php -r 'print_r(gd_info());'
Array
(
[GD Version] => bundled (2.1.0 compatible)
[FreeType Support] =>
[GIF Read Support] => 1
[GIF Create Support] => 1
[JPEG Support] => 1
[PNG Support] => 1
[WBMP Support] => 1
[XPM Support] =>
[XBM Support] => 1
[WebP Support] => 1
[BMP Support] => 1
[JIS-mapped Japanese Font Support] =>
)
This system is running on Debian 8.
--EDITED 2--
Using the alo-malbarez project as a base and a class to extract the frames of the GIF's, I made a project with a cleaner and clearer extractor class for people who need specific fragments of the GIF. In this project I combine both classes to make a GIF to WEBP converter, it still has bugs but I am working on correcting them.