phpThumbOf or pThumb for PDF thumbnails in Modx

815 Views Asked by At

I'm using phpThumbOf on my site to generate resized images on my modx site. Now I tried to do a download area where I want to show some thumbnails of PDFs, but its not generating them. When I try to use pThumb, it returns the sourcefile path.

I already confirmed, that ImageMagick and php-imagick are installed and enabled.

Also my local development environment should allow to use exec so I can't see why this isn't working.

Did someone got this to work already?

2

There are 2 best solutions below

1
achterbahn On

Is Ghostscript running in your setup? It's needed to generate thumbnails of PDFs.

Source: http://phpthumb.sourceforge.net/demo/docs/phpthumb.faq.txt

Quote:

Q: Can I make thumbnails from a PDF? A: Yes, as long as you have both ImageMagick and GhostScript installed. The AFPL version of GhostScript seems to work better than the GNU version (at least for me it does). http://www.imagemagick.org http://www.cs.wisc.edu/~ghost/ You may want to use the "sfn" (Source Frame Number) parameter of phpThumb to specify which page to thumbnail.

0
Guido Gallenkamp On

Use pThumb. It's the fork of phpThumbOf.

You say that you're already getting the image path (including the image?). You could put that into something like this:

<a href="[[+image:pthumb=`w=800&h=400&zc=0`]]" rel="lightbox" title="Click for enlagement" >
  <img src="[[+image:pthumb=`w=150&h=150&zc=0`]]" />
</a>

Or whatever options you might want. It is always good practice to output the image TV's as text, so you have full control over the actual code.