Inner exception - cannot read file (PHP use)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Crispin
Posts: 14
Joined: 2016-07-04T00:46:30-07:00
Authentication code: 1151

Inner exception - cannot read file (PHP use)

Post by Crispin »

Hi folks,


I've just started using imagemaick (amazingly awesome tool) with PHP and for the most part, it's working really well.


I am getting an exception though when trying to load a particular pdf to convert to png.
The error is that it cannot read the file.

Some basics on it:
  • The PDF is 87MB (1670-odd pages)
  • I have ample server RAM (64GB)
  • Ample space
  • It worked on hundreds of other pdfs I successfully converted to png.
  • The file is 777 and can be opened by FoxIt reader.
Not sure what else might be of use?

I've read about the forums on large pdfs and while there are a lot of instances where larger than this cannot be loaded due to resources, I don't think this is my case.


Is there anything else I can look for in terms of compatibility etc of the pdf?



Many thanks
Crispin
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Inner exception - cannot read file (PHP use)

Post by snibgo »

What version of IM are you using? What is the Q-number? What version of Ghostscript? What error message do you get? How long after it starts does it fail?

How many pixels per page? IM does the job by rasterizing the PDF, storing all the pages in memory before writing each page to a PNG. But it does this via Ghostscript, which might be failing here.
snibgo's IM pages: im.snibgo.com
Crispin
Posts: 14
Joined: 2016-07-04T00:46:30-07:00
Authentication code: 1151

Re: Inner exception - cannot read file (PHP use)

Post by Crispin »

All good questions for a noob :)
I will gather that info this evening and post it up for you. Thanks.
Crispin
Posts: 14
Joined: 2016-07-04T00:46:30-07:00
Authentication code: 1151

Re: Inner exception - cannot read file (PHP use)

Post by Crispin »

My version info

PHP: PHP Version 5.6.24

ImageMagick
Version: ImageMagick 6.7.8-9 2016-06-16 Q16 http://www.imagemagick.org

GPL Ghostscript 9.07 (2013-02-14)


ok, so something odd -

I set up a test page, simple script, just did the following

Code: Select all

		$imgPages = new imagick("/var/www/***/blabla.pdf");
		echo "|" . $imgPages->getNumberImages() . "|";
and... it works. I've no idea why it fails the "normal" way. This is the exact code...

Anyway, I'll debug some more and see.

It's 1468 pages big and takes ages to load and give me the page count (not that I am in a hurry)

Thanks for your time - will pop back if I find the problem...
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Inner exception - cannot read file (PHP use)

Post by Bonzo »

You are using Imagemagick through the php Imagick API which is not exactly the same.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Inner exception - cannot read file (PHP use)

Post by fmw42 »

What is the error message? Note that IM 6.7.8.9 is very old (over 150 versions old) and your ghostscript at 9.07 is old. IM is at 6.9.5.4 and Ghostscript is higher than my 9.16.
Crispin
Posts: 14
Joined: 2016-07-04T00:46:30-07:00
Authentication code: 1151

Re: Inner exception - cannot read file (PHP use)

Post by Crispin »

thanks for the hints.

I have to put this aside for a few weeks so when I'm back I'll pick it up and get it all updated.
I simply installed it thought pkg on CentOS7 (I think...) I will try update it when I am back on the project.


thanks again
C
Post Reply