문제

I'm using theses line to convert a pdf to a jpg:

$img = new imagick($url.'[0]');
$im->setImageColorspace(255);
$im->setCompressionQuality(95);
$im->setImageFormat('jpeg');

I have install imagick 3.1.0RC2 with the soft ImageMagick 6.7.7-10 2012-06-27 Q16 (x86). I also have a x86 PHP 5.4.22 non thread and I'm using IIS 8 on a windows server 2012. The php_imagick.dll is for 5.14 nts so it should work. The ghostscript version is gs9.10, I installed 32 and 64 bits. it is working perfectly with the msdos command line but no with PHP.

and then I got this error when I create the object.

ImagickException: Postscript delegate failed `D:\inetpub\website\sites\default\files\image_2.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/677 in Imagick->__construct()

is it an environment variables problem ? I've got the imagick folder and the bin folder of ghostscript as windows environment variable.

Any ideas ?

Cheers

도움이 되었습니까?

해결책

I finally found out the answer! The problem is the temporary folder of windows (c:\windows\temp) (your upload_tmp_dir in php.ini) has to be read and write for the user IUSR or IIS_IUSRS (depending of your IIS version) Thank you guys for your help

다른 팁

That seems to indicate that imagick can't find the ghostscript executable.

Ensure that the GS executable is in the relevant PATH:

<?php
phpinfo(INFO_ENVIRONMENT);
?>

...search that page for PATH.

If it's not there, add it in whichever script(s) needs it:

<?php
putenv(getenv('PATH').':path/to/ghostscript/executable')
?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top