forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: hoeksma on November 09, 2010, 07:48:22 am

Title: PDF First page thumbnail plugin
Post by: hoeksma on November 09, 2010, 07:48:22 am
I have writen a plugin which will create for all PDF's you upload a thumbnail and normal sized picture of the first page of the PDF you uploaded. It requires ImageMagick (convert) and ghostscript to be installed.

Fixed the issue below about the file test.

Sierk

Title: Re: PDF First page thumbnail plugin
Post by: Αndré on November 09, 2010, 09:03:42 am
Thank you for your contribution.
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 08, 2010, 06:41:53 am
I tried to install this plugin in "Coppermine Photo Gallery 1.5.10 (stable)", but all I get is:

Parse error: syntax error, unexpected T_BOOLEAN_AND in /home/XXXXXXXX/public_html/cpg15x/plugins/thumbnail_pdf/codebase.php on line 166

(I put the X's in to replace my user name)

Any chance someone could give me a little more insight into the problem?
Title: Re: PDF First page thumbnail plugin
Post by: Αndré on December 08, 2010, 08:59:43 am
Open codebase.php, find
Code: [Select]
if (is_pdf($file) ) && file_exists($normal)) { // is PDF    and replace with
Code: [Select]
if (is_pdf($file) && file_exists($normal)) { // is PDF   
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 08, 2010, 04:37:38 pm
Thank you very much  :)
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 09, 2010, 12:04:23 am
I successfully installed the plugin according to the plugin manager, and I'm running Coppermine on a server that I know has imagemagick and ghostscript on it, but it doesn't seem like I'm getting any thumbnails of pdf files.

I have successfully generated thumbnails using gallery2 on the same server, but I was hoping to replace gallery2 (which is an awful gallery compared to this one) with Coppermine which I know and love.

Hopefully, I'm doing something very simple the wrong way and someone can steer me in the right direction.

Thank you.
Title: Re: PDF First page thumbnail plugin
Post by: papukaija on December 09, 2010, 08:59:01 pm
someone can steer me in the right direction.

That would be much easier with a link to your gallery (which is required by board rules).
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 09, 2010, 10:07:57 pm
Oops! Sorry. I'm a newbie here.

http://www.mathshare.com
(which is also set up at http://www.math-drills.ca/mathshare/

and the gallery2 install that does work for thumbnails is http://www.math-drills.ca/gallery2/

Thanks for pointing out my mistake.

Peter
Title: Re: PDF First page thumbnail plugin
Post by: papukaija on December 11, 2010, 01:59:27 am
Do you get any error messages to your server's log or cpg's log?
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 11, 2010, 05:17:11 am
No errors other than a failed login and missing files: favicon.ico and robots.txt, but I don't think those are related.
Title: Re: PDF First page thumbnail plugin
Post by: papukaija on December 11, 2010, 10:22:36 pm
Are sure that you gave the correct absolute path to convert binary when you installed the plugin?
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 11, 2010, 11:42:44 pm
Yes, I used the same path as the Gallery2 install.
Title: Re: PDF First page thumbnail plugin
Post by: papukaija on December 12, 2010, 04:04:57 pm
Maybe it's a bug in the plugin. If you want to be sure about, set the cpg's graphic engine to imagemagic in your gallery's settings and try to add some images. If that works or if you're already using imagemagic in cpg, then it's a bug in the plugin. If not, it might be a good idea to contact your hosting's support about the imagemagick.
Title: Re: PDF First page thumbnail plugin
Post by: waycik on December 12, 2010, 04:44:22 pm
I tried that already and any images I upload get thumbnailed, but the pdf files don't. Method for resizing images is set to ImageMagick and the path is /usr/bin/, same as I gave to the plugin.
Title: Re: PDF First page thumbnail plugin
Post by: hoeksma on December 27, 2010, 10:51:57 am
Below i provide my configuration settings, hopes this helps
 
Absolute path to convert binary:   /usr/bin/convert
Width of the PDF Image:   300
Title: Re: PDF First page thumbnail plugin
Post by: Quinn on January 31, 2011, 12:21:48 am
This is not working for me either. Have tried all the above suggestions with no joy.

Link to galley in my signature...
Title: Re: PDF First page thumbnail plugin
Post by: AnnuN on May 26, 2011, 10:24:50 am
Dear I am using Wamp 2.0 and I already installed ghostscript 9 and Imagemagik on my system. Plugin installed successfully but I am unable to preview the PDF file.. So please help
Title: Re: PDF First page thumbnail plugin
Post by: Stramm on May 26, 2011, 10:48:54 am
You guys should make sure you not only to have installed ImageMagick but also to have told CPG to make use of it.
Title: Re: PDF First page thumbnail plugin
Post by: AnnuN on May 26, 2011, 11:01:53 am
Dear in configuration I am using this path as ImageMagik is placed on this absolute path and i.e.

D:\ImageMagick\convert.exe and I am specifying D:/ImageMagick/convert.exe 

and ghost script

C:\Program Files\gs\gs9.02\bin\gswin32.exe

Now tell me what o do next
Title: Re: PDF First page thumbnail plugin
Post by: Stramm on May 26, 2011, 01:20:21 pm
If you do not enter the path whilst installing the gallery, CPG is using GD2
It's in the config -> file settings , something like 'method to resize images'. Make sure this is set to ImageMagick
Title: Re: PDF First page thumbnail plugin
Post by: AnnuN on May 27, 2011, 07:56:26 am
Dear this is already set to ImageMagik...

Should I mention the ImageMagik path D:/ImageMagick/ or D:/ImageMagick/convert.exe
Title: Re: PDF First page thumbnail plugin
Post by: AnnuN on June 05, 2011, 09:57:44 am
Dear Please help me in this regard
Title: Re: PDF First page thumbnail plugin
Post by: papukaija on June 11, 2011, 04:55:37 pm
Dear this is already set to ImageMagik...

Should I mention the ImageMagik path D:/ImageMagick/ or D:/ImageMagick/convert.exe

It's documented here (http://documentation.coppermine-gallery.net/en/configuration.htm#admin_picture_thumb_advanced_im_path), there’s also a Windows specific warning  (http://documentation.coppermine-gallery.net/en/install_faq.htm#enableIMonWindows). Finally, please follow board rules (http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616) if you need more help.
Title: Re: PDF First page thumbnail plugin
Post by: Fabrian on October 17, 2011, 02:32:11 am
Hopefully this plugin is still supported and active.  I've read the thread, verified with my host that both ImageMagick and ghostscript are installed and what their paths are.

Having this information and trying everything I can think of, including changing the position of active plugins and checking file and folder permissions, I can't get this plugin to work.  This is a real bummer since it's exactly what I need.

Any suggestions would be great.
Title: Re: PDF First page thumbnail plugin
Post by: Fabrian on October 17, 2011, 02:42:16 am
Just realized I left the domain out.
Lakelandimagegallery.com
Title: Re: PDF First page thumbnail plugin
Post by: hoeksma on November 08, 2011, 02:19:05 pm
Hi all,

Sorry for not responding and maitaining pluging for sometime. I did some investigations and found out that there are problems with this plugin and the version of convert. The version i use (ImageMagick 6.6.9-6 2011-04-26 on linux) has problems with PDF documents created with abobe version 9 and above. It cannot read the document, causing convert to crash. This again is not logged by plugin.

To test if your system works, enter on commandline : convert <yourpdffile>  -colorspace RGB -geometry 2048 <imagefile>

If file is created then your system is capable of running plugin.


Sierk
Title: Re: PDF First page thumbnail plugin
Post by: mlodszy on February 03, 2013, 04:37:12 pm
I have a problem with this plugin. After convert I'm get something like that:

(http://testowausluga.osloskop.eu/albums/userpics/10001/normal_info.jpg)
Title: Re: PDF First page thumbnail plugin
Post by: mlodszy on February 05, 2013, 03:27:45 pm
Hi, after some investigation I find a way not only get a good quality of pdf first page but either of "eps" files. I used for it ghostscipt used directly. Only problem is that I don't know how to input it into this plugin.

Code: [Select]
gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -dJPEGQ=70 -sDEVICE=jpeg -dTextAlphaBits=4 -sOutputFile=$outputfile $inputfile
After run this "gs" generate image from first page. There can be added option
Code: [Select]
-r=WIDTHxHEIGHT
Can any developer help me with replacing imagemagic/conver with this tool? It's placed in /usr/bin
Title: Re: PDF First page thumbnail plugin
Post by: mlodszy on February 05, 2013, 05:58:22 pm
Ok, I menage to change some code and now get error like this:
Code: [Select]
images/thumbs/thumb_pdf.png
This is oryginal code:
Code: [Select]
$cmd = "{$CONFIG['thumbnail_pdf_path']} -q -o $ff_dest_file -sDEVICE=jpeg -dPDFFitPage {$src_file}";And I replace with this:
Code: [Select]
$cmd = 'gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -dJPEGQ=70 -sDEVICE=jpeg -dTextAlphaBits=4 -sOutputFile='."{$src_file}".' '.$ff_dest_file;