Jump to content

Recommended Posts

Posted

Hi, I'm trying to thumbnail PDF using ImageMagick but I am unable because -thumbnail appears to do nothing.

 

I've tried this on a seperate free web host just to check if it wasn't just me messing up, and it worked.

 

It is also worth noting that I can, in fact, thumbnail images on this server. My only issue here is trying to thumbnail PDF files, which I haven't been able to on this server.

 

convert -thumbnail 200x200 -colorspace rgb -quality 70 test.pdf test.gif

 

I've tried other methods such as:

 

convert -size 200x200 -geometry 200x200! -colorspace rgb -quality 70 test.pdf test.gif

 

This does correctly thumbnail the PDF to the appropriate dimmensions, however, the image is all black!

 

I would like to know what the issue is here. Thanks.

Posted

I don't have a pdf file to try so I can't say this works for sure. Try using the Imagick Class.

 

<?php
$thumb = new Imagick("your_image.pdf");
$thumb->thumbnailimage(200, 200, TRUE);
$thumb->setformat("gif");
$thumb->writeimage("thumb_nail.gif");
?>

 

Keeping it TRUE will produce a thumb that is proportional. Removing TRUE will force height and width.

 

 

 

Posted

I guess I should have said so sooner, I'm using Perl... Sorry

 

It's not proportions that bother me, it's the fact that no thumbnail is generated at all (using the first example of code in my previous post).

Posted

Did you try a pdf file with my php code to see if the server is converting pdfs? Would it be that much of a problem to use php if the code works?

 

 

Posted
I'm sure that's it. I'm still going to try PHP. Where do I request this feature?

 

Your still going to need Ghostscript for php too. Hopefully djbob will read this thread and post back to you.

 

 

 

Posted

Try installing the Ghostscript module for Perl from your cPanel first, and if that doesn't work I'll do it from root.

Posted

I'm not comfortable installing a separate package. Is it available as a module?

 

Also, how is PHP ImageMagick working without Ghostscript?

Posted
Also, how is PHP ImageMagick working without Ghostscript?

 

It doesn't because it has nothing to do with the programming language. ImageMagick uses Ghostscript for thumbnailing PDF files. ImageMagick is called by a covert command, which has nothing to do with programming language used to call the command in the first place. Observe:

 

[17-Sep-2009 15:41:58] PHP Fatal error:  Uncaught exception 'ImagickException' with message 'Postscript delegate failed '

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...