PDF Thumbnail Problem

Brandon Plewe
Joined: 26 Apr 2007

PDF Thumbnail Problem

Posted:01 Apr 2008 (16:45 UTC)
Win XP; Apache 2.0.47; PHP 5.2.5; bitweaver 2.0.0; magickwand-PHP 1.0.5; ImageMagick 6.4; Ghostscript 8.56

I am having trouble generating thumbnails for PDF uploads in Fisheye. When I upload, php_errors.log lists several non-fatal warnings:
01-Apr-2008 11:31:25 PHP Warning: Division by zero in C:\Web\wiki\liberty\plugins\processor.magickwand.php on line 57
01-Apr-2008 11:31:25 PHP Warning: Division by zero in C:\Web\wiki\liberty\plugins\processor.magickwand.php on line 61
01-Apr-2008 11:31:25 PHP Notice: magickgetimagemimetype(): a format may need to be set; the format returned by the MagickGetImageFormat() function was "(null)" in C:\Web\wiki\liberty\plugins\processor.magickwand.php on line 72
(repeated for each thumbnail generated)

I look in the storage folder, and all of the thumbnail files (icon.png, avatar.png, etc.) are exact duplicates of the original PDF file, with different names. If I convert them by hand, e.g.:
convert -resize 100x100 palette.pdf avatar.png
it works fine, and thumbnails will subsequently display in bitweaver fine. Any ideas?

One thing I'm wondering is that it appears that Magickwand-PHP 1.0.5 is built on IM 6.3.5, which doesn't match what I have installed. Might this be the problem? Does anyone have a windows binary for Magickwand-PHP 1.0.7?

BTW, other image formats upload just fine.

P.S.: If this helps anyone else: earlier I was getting fatal PHP errors when I tried to upload PDF files. It turns out the MagickWand I had (PHP distribution) was very old (0.1.8), and updating to 1.0.5 fixed it. Well, sort of.
Brandon Plewe
Joined: 26 Apr 2007

Re: PDF Thumbnail Problem

Posted:02 Apr 2008 (03:30 UTC)
I think I found the reason, but it's not happy news. Apparently, all of the recent windows binaries of magickwand that are available over the web are static builds without ghostscript support. Until a new dynamic build becomes available, I guess I'm stuck writing a python script that scans through the storage folder rebuilding thumbnails with the imagemagick command line.

Any other solutions?