function yttags_webp2gif($src_file_path, $file_destination_path, $colors_count = 16) { $image = imagecreatefromwebp($src_file_path); imagetruecolortopalette($image, false, $colors_count); $final_output = imagegif($image, $file_destination_path); if (false === $final_output) { return false; } imagedestroy($image); return $file_destination_path; }
Function usage:
echo yttags_webp2png('img/oldfile.webp','img/newfile.gif',100);