xxxxxxxxxx
The best one i think:
https://nsspot.herokuapp.com/imagetowebp/
xxxxxxxxxx
function hs_webp2jpg($source_file, $destination_file, $compression_quality = 100)
{
$image = imagecreatefromwebp($source_file);
$result = imagejpeg($image, $destination_file, $compression_quality);
if (false === $result) {
return false;
}
imagedestroy($image);
return $destination_file;
}
xxxxxxxxxx
function hs_jpg2webp($source_file, $destination_file, $compression_quality = 100)
{
$image = imagecreatefromjpeg($source_file);
$result = imagewebp($image, $destination_file, $compression_quality);
if (false === $result) {
return false;
}
imagedestroy($image);
return $destination_file;
}