我正在开发一个面板,在该面板中,我上传jpg,对其进行复制,调整其大小,保存另一个jpg,现在我还希望能够使用webp扩展名来创建副本。
我检查了所有地方,找不到任何遇到相同问题的人。 我在CentOS上运行cPanel cPanel>版本:ImageMagick 6.9.10-68 Q16 x86_64 2020-04-01
$imagick = new \Imagick($targetJpg);
$imagick->writeImage('webp:'.$targetWebp);
我遇到此错误
致命错误:未捕获ImagickException:委托失败''cwebp' -quiet%Q'%i'-o'%o''@ error / delegate.c / InvokeDelegate / 1928 /...dirs.../pic-upload.php:108堆栈跟踪:#0 / ...目录... / pic-upload.php(108): imagick-> writeimage('webp:../ images / ...')#1
================================================ =========
在我的本地计算机上,使用Mamp的OSX在@MarkSetchell帮助下得以解决。
在OSX上>终端 类型:cwebp -version webp 1.1.0
类型:键入cwebp cwebp被散列了(/ usr / local / bin / cwebp)
标记解决方案>已成功! :) 在macOS上,您的cwebp似乎是/ usr / local / bin中的自制软件,因此我建议您找到名为ilegs.xml的Imagick配置文件并对其进行编辑,以使其在显示“ cwebp”的位置-quiet -q%Q '%I'...变成'/ usr / local / bin / cwebp'-quiet -q ...
================================================ =========
在CentOS cPanel中
未安装cwebp或dwebp。这是由于未安装libwebp-tools软件包。
我安装了它们并检查了-结果: [root @ server:/] $ where cwebp cwebp:/ usr / bin / cwebp /usr/share/man/man1/cwebp.1.gz [root @ server:/] $ where dwebp dwebp:/ usr / bin / dwebp /usr/share/man/man1/dwebp.1.gz
现在一切正常! 希望这对其他人有用。 感谢Mark和Chris的帮助