#9059 ([PATCH] sfThumbnailPlugin misses an option for PDF files)

You must first sign up to be able to contribute.

Ticket #9059 (closed defect: invalid)

Opened 6 years ago

Last modified 6 years ago

[PATCH] sfThumbnailPlugin misses an option for PDF files

Reported by: garak Assigned to: fabien
Priority: minor Milestone:
Component: sfThumbnailPlugin Version: 1.4.6
Keywords: Cc:
Qualification: Unreviewed


The current version of sfThumbnailPlugin allows creation of thumbnails of PDF files, but in a way that is likely useless: for each page of PDF file, a thumbnail is generated, with name like pdffile-0.jpg, pdffile-1.jpg, etc. The proposed patch adds an option to extract thumbnail only from first page, that is mostly the expected behavior (see how all file navigators in major systems generate their thumbnails), but is still back-compatible (the new option is false by default). As a bonus, I added a rewriting of README file that respect the current markdown dingus ;-)


patch.txt (12.0 kB) - added by garak on 09/09/10 15:32:56.

Change History

09/09/10 15:32:56 changed by garak

  • attachment patch.txt added.

10/25/10 00:07:48 changed by halfer

If you supply the option array('extract' => 1) to the IM adaptor, this problem is resolved without code changes. I think this is a preferable to the proposed patch, since it permits the client system to specify which page should have a thumb generated (which would be useful, say, when uploading a PDF file and thumbs of all pages are required).

There is a minor bug in the IM adaptor in that, although the 'extract' option is used when generating the image, determining the input dimensions ignores the option. This bug is covered in #4116. Once this is applied, sfAssetsLibraryPlugin generated PDF thumbs for me just fine.

(Incidentally, I would recommend that multi-image files should not be thought of just as PDF files, since TIFF images can also contain several pages. There may be other formats that do this. Accordingly, I'd tend to write any associated code without mentioning a specific format.)

I therefore propose this patch is not merged, but I am happy (of course) to hear if I've misunderstood something :-)

10/25/10 00:21:15 changed by halfer

By the way, if you agree with my analysis, would you amend the penultimate paragraph in the markdown readme for sfAssetsLibraryPlugin? (NB: that plugin won't work with either approach unless it is specifically added into the sfThumbnail instantiations in sfAssetsLibraryTools::createPdfThumbnail() anyway! - I'll raise a ticket on that.)

10/30/10 18:43:25 changed by garak

  • status changed from new to closed.
  • resolution set to invalid.

halfer, you're absolutely right. I'm closing this ticket as invalid. Thank you.