Erratic behavior of new Imagick()

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
ppick

Erratic behavior of new Imagick()

Post by ppick »

My php code looks like this:

Code: Select all

    
    $file1 = 'http://www.ada.gov/newsltr0606.pdf';
    $im1 = new Imagick($file1);  

    $file2 = 'http://www.nano.gov/NNI_SigInit_Nanoelectronics_Feb_2010.pdf';
    $im2 = new Imagick($file2);  
Both are valid pdf files. With the first pdf, everyhting works well and I can make a snapshot of the pdf. With the 2nd pdf, I get this error:

Wand contains no images `MagickWand-2'
and it catches an exception (does not work). Can anyone reproduce this issue? Why does it work in one case, not the other?

I am on a shared hosting plan, and I have no control about the version installed, which is by the way:


Image

My PHP version and system is:


Image
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Erratic behavior of new Imagick()

Post by mkoppanen »

Hi,

the error means that the image could not be read. Imagick before 3.0.0 sent out wrong error message for read failures. Most likely the error is that 'gs' command is not in $PATH
Mikko Koppanen
My blog: http://valokuva.org
ppick

Re: Erratic behavior of new Imagick()

Post by ppick »

Yes, but I do not understand why it works for one of the 2 pdf files, not for the other. Both pdf files are existing files that can be accessed via a browser without error.

Can you reproduce this issue?
Morgon

Re: Erratic behavior of new Imagick()

Post by Morgon »

Can you copy the files locally with file_get_contents or the like? Perhaps it's a transmission error or something on the second site that prevents automated downloads?
Post Reply