简体   繁体   中英

Executing ImageMagick from php. Trying to convert first pdf page to png

I have the following code:

$input = "C:/wamp/www/lnu/components/com_djclassifieds/images/item/input.pdf";
$output = "C:/wamp/www/lnu/components/com_djclassifieds/images/item/output.png";
exec("C:\Program Files\ImageMagick-6.8.9-Q16\convert -density 400 {$input}[0] -resize 25% {$output}");

I also tried exec('C:\\Program Files\\ImageMagick-6.8.9-Q16\\convert -density 400 "'.$input.'"[0] -resize 25% "'.$output.'"'); , and it does not work.

I think this should work because in my command line I type: C:\\Program Files\\ImageMagick-6.8.9-Q16>convert -density 400 "c:/test.pdf"[0] -resize 25% "c:/out.png" , and it works.

Any advise?

检查Apache用户是否对该文件具有写权限。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM