我试图使用imagecreatefromwebp()将webp文件转换为JPEG,但不幸的是,它向我抛出了一个警告:警告: imagecreatefromwebp():WebP解码:未能解码输入数据.
这是我的密码
$filename = dirname(__FILE__)."\\".$keyword."1.webp"; // $keyword = 'xyz';
$im = imagecreatefromwebp($filename);
// Convert it to a jpeg file with 100% quality
imagejpeg($im, './example.jpeg', 100);
imagedestroy($im);请帮帮忙。
发布于 2018-09-06 12:06:19
我正在使用这个代码,它对我来说很好。这里,$data包含base64encoded数据
$im = imagecreatefromwebp($data);
$imageResult = imagejpeg($im, $destinationPath . $fileName, 100);
imagedestroy($im);imagecreatefromwebp()函数接受有效的file或URL。您还可以在该函数中传递二进制数据。您可以在这里检查函数定义和示例,http://php.net/manual/en/function.imagecreatefromwebp.php
https://stackoverflow.com/questions/44472308
复制相似问题