Announcement

#1 2023-03-03 15:21:40

chanou
Member
2023-03-03
1

How to generate thumbnails for PDF ?

Hello,

I'm using piwigo 13.6, charlies plugin 3.5 and o2switch hosting web server.

I would like to automatically generate thumbnails for my PDF.
I've already looked at all the things posted online about it, but cant find a way to make it work.

I'm using FTP to feed my "galleries" folder.

I've read all the read me files into charlie plugin but cant find a clue about what I should do.

Thanks a lot and have a nice day
Chanou

Piwigo 13.6.0 Check for upgrade
Installed on 24 July 2022, 7 months 1 week 2 days ago
Operating system: Linux
PHP: 7.4.33 (Show info) [2023-03-03 11:13:49]
MySQL: 5.5.5-10.6.12-MariaDB [2023-03-03 11:13:49]
Graphics Library: ImageMagick 7.1.0-20
Cache size 74.51 Mo   calculated 7 months ago Refresh

Piwigo URL: https://drive.lasd.online/

Offline

 

#2 2023-03-03 17:32:37

TOnin
Member
1970-01-01
106

Re: How to generate thumbnails for PDF ?

HI,
You are using [extension by jdd] Charlies' content
Have you read and try this following link? Is it easy to understand, or hard ? Can you provide any error message ?
http://www.dodin.org/wiki/pmwiki.php?n= … es#toc-6.2

I would say, either you run this script through a ssh connexion to your host; either you run it home/work-place and then deliver thumbs through FTP to your host. Which OS are your running at home/work-place ?

I haven't read the forum topic which link is given in extension page. It is now a broken link, here is the updated link:
https://piwigo.org/forum/viewtopic.php?id=10671

Offline

 

#3 2023-03-03 17:49:21

TOnin
Member
1970-01-01
106

Re: How to generate thumbnails for PDF ?

At the end of the topic, year 2021, Katryne seems struggling to get pdf representatives. She may give you an answer, and advices too. She was using virtual albums, and photos were not brought by FTP, so a bit different, or maybe a big difference.
https://piwigo.org/forum/viewtopic.php? … 51#p180551

Offline

 

#4 2023-03-03 20:58:05

Katryne
Member
2016-12-03
370

Re: How to generate thumbnails for PDF ?

Hello !
First of all, I tell you the reason why 2 years ago, the uploaded pdf suddenly stopped having their thumbnail automatically generated. I explain in plain words, for I am no technician.

There was a new release of the server software ImageMagick, and same thing for the library External ImageMagick. From this update on, by default, the library would create thumbnails only for image files.

There is a setting that could activate the thumbnail creation for other files such as pdf, but only those who  can manage their server can do it.

I can't. My sites are on shared hosting. Or on a hosting I cannot manage myself.

At Ionos, where the library is External ImageMagick, I asked the manager to enable the option for pdf. They refused.

At OVH, where my sites are on a dedicated server, but I am not the manager, I asked the manager to modify the settings. There, it is Imagemagicks (not external). He did modify the settings, but to no avail. I still could not have my pdf thumbnails created.

In our historical society, we provide about 500 pdf. I needed a solution.

So I started making my pdf thumbnails.
For this I use on my computer the last free release of PDF-XChange Viewer,  v.2.5.322.10 which is no longer developed but perfectly functional and, above all, keeps a measured weight. There is an option when viewing a pdf to export the displayed page to an image file. In a click, it's done.
https://www.tracker-software.com/downlo … bc74b02340

Then, in the Piwigo, I installed the Photo Update plugin which create a new tab in the photo edition.

Each time I upload a PDF, I edit it immediately and with the Photo Update tab, I upload then its thumbnail.
https://piwigo.org/ext/extension_view.php?eid=566


http://photos.katrynou.fr/ v.14.1.0 https://album.chauvigne.info/ v.13.8.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.0.28 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#5 2023-03-04 11:39:58

TOnin
Member
1970-01-01
106

Re: How to generate thumbnails for PDF ?

Thank you for this feedback Katryne.

So Charlie's content is not needed for pdf thumbnail. You just need to append to any /path/to/xyz.pdf file its representative jpeg picture which has to be /path/to/pwg_representative/xyz.jpg.
https://piwigo.org/doc/doku.php?id=user … ture&s[]=pwg_representative

To render a jpeg picture, an alternative is to use Gimp software. Gimp can import a pdf, then export as xyz.jpg.
https://www.gimp.org/
It looks not possible to batch this on the first page only...
https://www.gimp.org/tutorials/Basic_Batch/
https://www.gimp-forum.net/Thread-How-t … 3#pid11313
My guess try which fails:
gimp -i -b '(file-pdf-load 1 "file.pdf" "pwg_representative/file.jpg")' -b '(gimp-quit 0)'

With ImageMagick convert, in a directory with some pdf files:
for f in `ls *.pdf` ; do r=pwg_representative/`echo "$f" | sed -e "s/\.pdf/.jpg/"` ; convert  -density 300  -depth 8  -quality 90  $f[0]  $r ; convert $r  -resize 25% $r ; done
Inspired from: https://stackoverflow.com/questions/126 … page-pdf-t

In order to automatically generate all pdf from the gallery, a plugin (or extension) inspired from videoJS poster generation could be written.

Offline

 

#6 2023-03-04 20:10:15

Katryne
Member
2016-12-03
370

Re: How to generate thumbnails for PDF ?

TOnin, your instructions are not suitable for my intellectual capacities. I am not a computer scientist, I never work with command lines. My knowledge is very basic and I use the simplest techniques: I always upload my documents through the Piwigo administration interface, never through ftp and never through a third party application.

I don't understand what you want to do with "automatically generate all pdf from a gallery."

I wasn't trying to create a pdf from an album, I was trying to create a thumbnail of a pdf.


http://photos.katrynou.fr/ v.14.1.0 https://album.chauvigne.info/ v.13.8.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.0.28 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#7 2023-03-06 11:34:56

TOnin
Member
1970-01-01
106

Re: How to generate thumbnails for PDF ?

Katryne, I wasn't replying directly to you, but to chanou. Then, I forgot to say I'm a Linux user with a bit of script knowledges. Most of my post is about sharing what I have tried, what is working for me, and what could be done.
Anyone reading this topic can pick what she/he prefers.
Your process to manage pdf thumbnails is fine to me, except I won't use PDF-XChange Viewer because not available on Linux.

Offline

 

#8 2023-03-06 12:21:33

Katryne
Member
2016-12-03
370

Re: How to generate thumbnails for PDF ?

Sorry TOnin if I seemed to speak a bit curtly. I'm an exclusive windowsian, a literary person and on top of all that, a girl. Add to that the fact that English is not my first language, I was under the impression that you were speaking Klingon, in another universe, about another project.


http://photos.katrynou.fr/ v.14.1.0 https://album.chauvigne.info/ v.13.8.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.0.28 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#9 2023-03-06 13:20:40

TOnin
Member
1970-01-01
106

Re: How to generate thumbnails for PDF ?

Thank you, I just discovered new words! curtly and Klingon (which are not provided in my Linux release). I'm sorry too, but...
Most of all, I hope Chanou will find a suitable solution.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact