【问题标题】:Image magick code working on centos but not on windows图像魔术代码在centos上工作但在windows上不工作
【发布时间】:2013-03-13 19:21:13
【问题描述】:

下面是我的代码

exec("convert -page 90x54 script_o.gif \\( script_o.gif -repage +37+0\! \) output.gif");

这在我的网络服务器(centos)上运行良好,但在我的 wamp 服务器上不起作用,但我检查了其他在 wamp 服务器上运行良好的 im 代码,对于上述 wamp 服务器代码是否有任何修复

【问题讨论】:

    标签: php imagemagick imagick imagemagick-convert


    【解决方案1】:

    问题是 Windows 已经有一个名为 convert 的二进制文件来将 FAT 卷转换为 NTFS,该二进制文件位于 PATH 中,因此它被执行而不是你的 imagemagick 文件。要尝试这样做,只需打开一个 Windows shell 并输入 convert /? 并按 ENTER,您将看到另一个 convert 的输出。

    解决方案是在命令中指定 imagemagick convert 二进制文件的绝对路径。

    类似这样的:

    exec("c:\\imagemagick_folder\\bin\\convert.exe -page 90x54 script_o.gif \\( script_o.gif -repage +37+0\! \) output.gif");
    

    【讨论】:

    • k 让我将其更改为完整路径...并让您知道。谢谢
    • 我已经用一个示例命令更新了我的答案,只需使用双反斜杠来分隔文件夹。
    • 嗨 Nelson,我已经更改了我的代码,但仍未修复 exec("c:\\imagemagick\\convert.exe -page 90x54 script_o.gif \\( script_o.gif -repage +37+0\! \) output.gif");convert.exe 在 imagemagick 文件夹中......还有一件事我通过 php 而不是通过命令运行它
    • 这是另一个问题,可能你传递的参数是错误的,你像\\(\)这样的转义对我来说似乎很可疑,也许你不需要它们,无论如何只需检查执行转换的输出单独 .exe 看看你是否得到了 imagemagick 的输出,然后你知道正在调用正确的二进制文件,然后你去修复参数。
    • 嗯我只是尝试将 imagemagick convert 重命名为 convertme 然后尝试运行相同的代码而不提供任何位置,但仍然是相同的问题:(
    猜你喜欢
    • 1970-01-01
    • 2012-12-01
    • 1970-01-01
    • 2015-10-19
    • 2013-04-14
    • 2017-08-05
    • 1970-01-01
    • 2012-07-04
    • 1970-01-01
    相关资源
    最近更新 更多