Page 1 of 1

Failed to open file

Posted: 2018-10-01T03:47:05-07:00
by Irhak
Hi! I don't know if I write to right thread.

I have installed ImagickMagick 6 on Debian Jessie (and also Wheezy) through apt-get. Using imagick function I was able to create jpg version of pdfs till last month. Today I stamble upon a problem with this. Every time I try to use it to create jpg from pdf I error "Failed to open file" pop-up, even when I'm using old pdfs that worked before. Pdfs are opening normally (outside scripts that using imagick) without any problem. With jpegs there are no problems, imagick->readImage($dest) read file without any issues.

There was no updates made in last few weeks so no new code could affect it. Especially that last week it worked fine.

Here is a fragment of the code I use:

Code: Select all

$image = new imagick();
$image->setResolution(300, 300);
$image->readImage($dest);
$image->setImageFormat('jpg');
$image->writeImage($preview);
$image->clear();
$image->destroy();
Is the file path an issue suddenly (e.g. /var/www/userfiles/1/ads/2018-09/GRAFFI-STUDIO-7640.pdf)? or maybe there was some date inside imagick or ghostscript that make it expired?

Re: Failed to open file

Posted: 2018-10-01T09:50:46-07:00
by fmw42
Try moving the file to some other directory? Perhaps there is some permission issue. If you download the file, can you open it? Has it become corrupt?

Re: Failed to open file

Posted: 2018-10-02T00:15:57-07:00
by Irhak
PDF is fine. I can open it without any errors. Imagick can't read any pdf file - neither new or the old that was already processed. It all started yesterday.

Re: Failed to open file

Posted: 2018-10-02T03:06:31-07:00
by magick
From the command line, type

Code: Select all

convert mypdf.pdf null:
Do you get an authorization exception? If so, check your system policy.xml configuration file. There is a policy that prevents ImageMagick from reading PDF files. See https://www.imagemagick.org/script/security-policy.php.

Re: Failed to open file

Posted: 2018-10-08T03:14:44-07:00
by Irhak
Weirdest thing ever. I left the problem for some time and after that the problem was gone. Looks like it is safe now. Problem left same as it come - unexcpected.