php exec imagemagick- magick转换不工作Ubuntu Linux
我正在使用 ubuntu 并安装了 ImageMagick
identify -version
给出:
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
我尝试过:
exec('magick img.jpg ( -clone 0 -fill white -colorize 100 ) ( -clone 0 -color-threshold "gray(251)-gray(254)" ) -compose over -composite -quality 80% result.jpg', $output, $return_var);
echo '<pre>' , var_dump($output) , '</pre>';
还使用 convert
和 magick Convert
而不是 magick
然后根据 这个答案我打开了/etc/ImageMagick-6/policy.xml
并且将
更改为
但仍然不起作用,并且 $output
总是返回空数组
PS:我不想使用 PHP 扩展,已经使用了,而且它有一些缺陷
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请使用PHP进行ImageMagick进行一些测试,以了解您的版本是什么。请提供每个返回的消息。
这个工作吗?
你收到什么消息?
Please do some testing in Imagemagick with PHP to see what your versions are. Please provide any messages that come back for each.
Does this work?
What messages do you get?
转换将其输出写入磁盘(
result.jpg
)。exec()
的输出参数是否为stdout的任何输出。如果您希望$ output
中的图像数据指定的输出文件 -
。引用男人页面:
Convert writes its output to disk (
result.jpg
). The output argument ofexec()
if for any output to stdout. If you want the image data in$output
specify an output file of-
.To quote the man page: