Project

General

Profile

Actions

Feature #22481

closed

Show thumbnails for PDF attachments

Added by Gregor Schmidt about 8 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

If GhostScript is installed, ImageMagick is able to handle PDF files as well. This could be used to create thumbnails for PDF attachments.

The attached patch adds this feature. It is based on current trunk (r15332)

It does a couple of things:

It adds a Redmine::Thumbnail::gs_available?

This method tries to determine if GhostScript is installed. It does so by checking if GhostScript binaries are found in the PATH. This might be insufficient, since ImageMagick might be configured to use the GhostScript libraries without the binaries being installed. But this is rather unlikely.

This property is also made available in /admin/info and descriptions for English and German are added.

Attachment#thumbnailable? is extended

So that, if GhostScript is available, PDFs are also considered thumbnailable

Redmine::Thumbnail::generate is extended

to create PDF thumbnails. Thumbnails will only show the first page ([0] at the end of source parameter) and they will be stored in PNG format (png: at the beginning of target parameter).

AttachmentController#detect_content_type is extended

to return image/png if an attachment thumbnail of a PDF is rendered. In all other cases the thumbnails format used to match the attachment's. But this was not feasible for PDF files.


Files


Related issues

Related to Redmine - Feature #22915: Additional filetypes (tif,tiff) for thumbnails generationNew

Actions
Related to Redmine - Feature #25988: Preview files by default instead of downloading themClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #32307: AttachmentsControllerTest#test_thumbnail_for_pdf_should_be_png fails if ImageMagick convert is not availableClosed

Actions
Related to Redmine - Feature #32898: PDF thumbnails support on WindowsClosedGo MAEDA

Actions
Related to Redmine - Defect #33283: Thumbnail support for PDF attachments may not be detectedClosedGo MAEDA

Actions
Has duplicate Redmine - Feature #16626: Preview first page pdf file as a jpg fileClosed

Actions
Actions

Also available in: Atom PDF