Last modified: 2007-08-18 10:00:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 6288 - Support for thumbnails generated from PDF files
Support for thumbnails generated from PDF files
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
All All
: Lowest enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-06-12 22:28 UTC by Sean Tobin
Modified: 2007-08-18 10:00 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Allow generation of pdf thumbnails (4.87 KB, patch)
2006-10-10 22:13 UTC, Thomas Bleher

Description Sean Tobin 2006-06-12 22:28:52 UTC
I'd like to see support for generating thumbnail images from PDF files. Ideally,
the ability to select the page to make a thumbnail of (with page 1 being the
default) and the ability to rotate the resulting image (in multiples of 90

Some syntax examples would be:
[[image:contract.pdf|thumb]] - Would generate a thumbnail of page 1 of the pdf
at the default size
[[image:contract.pdf|thumb|page=4]] - Would generate a thumbnail of page 4 of
the pdf at the default size
[[image:contract.pdf|thumb|rotate=90]] - Would generate a thumbnail of page 1 of
the pdf with a rotation of 90 degrees

Other image modifiers would be unchanged. Also, ImageMagick supports pdf
natively so the hard work is already done. 

The reason for requesting rotation modifiers is that some versions of Adobe
Acrobat rotate pages via the PDF header and ImageMagick when generating a
thumbnail of those pages ignores the rotation. Arguably, this is an ImageMagick
bug, but the ability to rotate a thumbnail is available in ImageMagick, and
potentially usefull in non-pdf images as well.
Comment 1 Fastfission 2006-07-19 16:41:34 UTC
I'd second at least the ability to have it auto-generate thumbnails (or image pages) for the first page of a PDF file. Currently it 
outputs an awkward and ugly generic icon (see, i.e. It 
should not be hard (since ImageMagick already can rasterize PDFs) to have it just use the first page of the PDF as an image, 
and it would really open up the usage of PDFs with MediaWiki.
Comment 2 Thomas Bleher 2006-10-10 22:13:48 UTC
Created attachment 2492 [details]
Allow generation of pdf thumbnails

This patch adds support for thumbnails for pdf files.
It's a bit hacky right now, but works on a production system and demonstrates
the concept.
The problem with PDF is that each page can be of a different size and
orientation. This patch deals with this by using identify(1) on the original
image, everytime a thumbnail is created. This works, but is quite costly.

Eventually, the size of every page should be stored in the database. The page
sizes can easily be retrieved using "identify -format '%@\n' $filename"

Note: This patch is against Mediawiki SVN as of today (r16906).
Comment 3 Thomas Bleher 2006-10-10 22:19:02 UTC
To see the code in action, look here:
This also demonstrates that ImageMagick doesn't correctly rotate pdfs (as Sean Tobin noted).
Comment 4 ThomasV 2007-08-18 10:00:19 UTC
support for pdf is now available through the PdfHandler extension.

Note You need to log in before you can comment on or make changes to this bug.