Topic on Project:Support desk

Force thumbnail generation with PdfHandler?

6
Kjecl (talkcontribs)

I recently performed an reinstall and database restore of a Wiki to fix a different problem. An unexpected positive side effect was that thumbnails are now generated for new PDF files uploaded to the Wiki. Cool!

Is there a way to force the generation of thumbnails for previously uploaded PDFs? I have tried:

php refreshImageMetadata.php -f

followed by:

php rebuildImages.php

without effect.

Thanks for any suggestions.

Bawolff (talkcontribs)

What do the old images look like? Is there an error message instead of a thumbnail or is it just missing. Does mediawiki show the correct dimensions for the files in question (as in, does it say it is 0x0 pixels or does it give a real number)?

Kjecl (talkcontribs)

Thank you for your interest in my problem.

The thumbnails for older files are a red stylized 'A' on a white background. Nope, no error message.

If I go to the Special:ListFiles page, and click on a red A icon, it shows dimensions of 0 x 0.

I wonder if I could use importImages.php to reload all of the older files. An experiment is in order for one of those files, I think.

Kjecl (talkcontribs)

Yes, I can use importImages.php to reload an older file. No, it does not help.

Bawolff (talkcontribs)

So the 0x0 usually means that Extension:PdfHandler had problems running the pdfinfo command, which would prevent the creating of thumbnails.

However if new files are working, then that means that it should be able to run the pdfinfo command.

In general, running refreshImageMetadata.php -f should fix that. Does the script actually say it refreshed the file in question? If it still isn't working, i could see two possible problems:

  • some sort of cache issue. You could try adding ?action=purge (or &action=purge ) to the end of the File: page (the page in the wiki, not the actual file) to see if that does anything to help
  • the older files aren't readable by the webserver. This could potentially happen if when you transfered webservers the image files had the wrong permissions or some other sandboxing system prevented access.

Both of those feel kind of a long shot though.

Of course its always possible the file being tested is just a broken pdf.

Kjecl (talkcontribs)

I used:

ls -lR | grep -v -e <string>

at the top level of the image upload folder, where string was either the owner or the permissions, to check that. I did not find any files with the wrong permissions or ownership.

refreshImageMetadata.php -f

does not say that it refreshed the files (~80 of them) in question. pdfinfo is able to run against all of the files in question sufficiently to report the PDF version. PDF versions for these files range from 1.3 to 1.7.

FILES=$(find $PREFIX -name "*.pdf" -type f | grep -v "/temp" | grep -v "/deleted" | grep -v "/archive" )

for F in $FILES; do

   echo $(pdfinfo $F | grep "PDF version")    $F

done

So, there are about 80 of these files with the 'red A' thumbnails. Apart from the likelihood of error, we could re-upload all of them to get the new thumbnails. We would prefer not to need to take that approach. Also, there is the concern that this symptom betides some problem that will bite us later.

Thanks again for your help.

Reply to "Force thumbnail generation with PdfHandler?"