【问题标题】:how can i run imagemagick commands in php?如何在 php 中运行 imagemagick 命令?
【发布时间】:2011-03-02 13:56:05
【问题描述】:

我需要弯曲文本并将其放在另一个图像上。我从他们的网站上得到了下面提到的代码,但它不起作用;有人请告诉我如何在 php 中执行此操作。我的系统将支持 imagemagick 及其启用..

转换(newmug1.jpg -thumbnail 200x200 -write mpr:image +delete)\ ( -pointsize 20 -fill red -background none label:"Cottenham horse show" -virtual-pixel transparent -distort arc 120 -write mpr:arc +delete ) \ mpr:image mpr:arc -gravity north -composite combined.jpg

请帮帮我

感谢和问候

提斯蒙

【问题讨论】:

标签: php imagemagick


【解决方案1】:

使用exec 命令 - http://php.net/manual/en/function.exec.php

exec('convert ( newmug1.jpg -thumbnail 200x200 -write mpr:image +delete ) \ ( -pointsize 20 -fill red -background none label:"Cottenham horse show" -virtual-pixel transparent -distort arc 120 -write mpr:arc +delete ) \ mpr:image mpr:arc -gravity north -composite combined.jpg');

【讨论】:

  • 感谢您的回复,但它对我不起作用。我已将“exec”更改为“system”;但这也失败了。这是我使用的代码
  • 将命令用引号括起来 ' 而不是引号 makrs " 因为你有一个 " 在命令中
【解决方案2】:

试试这个

exec("<full path to binary> '-dNOPAUSE' '-sDEVICE=jpeg' '-r<resolution>'
     '-g<dimensions' '-dUseCIEColor' '-dTextAlphaBits=4' '-dGraphicsAlphaBits=4'
     '-o<where you want the image stored>' '-dJPEGQ=<quality - I used 90>'
     '<pdf file to resize>'", $outputArray);

如果占位符是用变量填充的,变量,如$resolution,直接进入命令,如-r$resolution

您可能还会发现此website 很有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-01
    • 1970-01-01
    • 2015-05-08
    • 2018-04-09
    相关资源
    最近更新 更多