Imagemagick将pdf转换为png [英] Imagemagick convert pdf to png

查看:280
本文介绍了Imagemagick将pdf转换为png的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新使用命令行和php。这就是说,我一直在试图找出如何使用ImageMagick与exec()函数。我目前有,

I am rather new to using the command line and php. That being said I have been trying to figure out how to use ImageMagick with the exec() function. I have this currently,

$command="/usr/local/lib/ImageMagick  convert images/a.pdf images/a.png"; 

if(exec($command)){
    echo 'yes';
}
else{
    echo 'no';
}

这是返回no。我相信我缺少一些关于如何从正确的目录执行转换。是我的$命令设置正确吗? (我从我的网络主机Lunarpages得到了ImageMagick的路径)。

Which is returning 'no'. I believe I am missing something about how to execute convert from the correct directory. Is my $command set up properly? (I was given the path to ImageMagick from my web host, Lunarpages).

我已经阅读了关于ImageMagick的一些其他问题,但我没有找到太多帮助我设置我的命令。

I have read through some of the other questions regarding ImageMagick but I haven't found much to help me set up my command.

感谢任何帮助,

Levi

Thanks for any help,
Levi

推荐答案

你的命令当前尝试做的是执行一个名为/ usr / local / lib / ImageMagick的程序,我猜这不是你打算的。如果这是到ImageMagick的路径,并且您想要使用convert实用程序,您需要将您的命令修改为以下内容:

What your command is currently attempting to do is execute a program named /usr/local/lib/ImageMagick which I am guessing is not what you were intending. If that is the path to ImageMagick and you want to use the convert utility you need to modify your command to the following:

/usr/local/lib/ImageMagick/convert images/a.pdf images/a.png

点它应该工作没有任何问题!你可能想进一步深入了解convert命令可以为你做什么!

At which point it should work without any issues! You may want to dig further into what the convert command can do for you!

这篇关于Imagemagick将pdf转换为png的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆