To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Ticket #244 (closed defect: fixed)

Opened 22 months ago

Last modified 22 months ago

Create a Capabilities Call for NetPBM / Ghostscript to know if PDF Previews can be created

Reported by: johnnyoffline Owned by: boutell
Priority: critical Milestone: 1.4
Component: apostrophePlugin: Media Version: trunk
Keywords: netpbm, ghostscript, pdf Cc: geoffd, hillerj, rickybanister, dordille, johnnyoffline, agilbert,
Symfony version: 1.4

Description (last modified by johnnyoffline) (diff)

I need a way to know IF a good PDF preview can be created or not in the Media library. This is true for all production environments including Windows.

If you create a call to check for NetPBM and Ghostscript, we can determine whether or not to display a "canned" PDF preview image or an actual preview of the file.

I need this in the 1.3 Branch, but the functionality should probably exist in the Trunk as well.

_mediaItem.php, line 25:

<li class="a-media-item-thumbnail">
<?php include_partial('aMedia/editLinks', array('mediaItem' => $mediaItem)) ?>
  <a <?php echo $linkAttributes ?> class="a-media-thumb-link">
    <?php if ($type == 'video'): ?><span class="a-media-play-btn"></span><?php endif ?>
    <?php if ($type == 'pdf'): ?><span class="a-media-pdf-btn"></span><?php endif ?>
    <img src="<?php echo url_for($mediaItem->getScaledUrl(aMediaTools::getOption('gallery_constraints'))) ?>" />
  </a>
</li>


Attachments

pdf-media-item.png Download (94.0 KB) - added by johnnyoffline 22 months ago.

Change History

Changed 22 months ago by johnnyoffline

Changed 22 months ago by johnnyoffline

  • description modified (diff)

Changed 22 months ago by johnnyoffline

  • cc geoffd, hillerj, rickybanister, dordille, johnnyoffline, agilbert, added

Changed 22 months ago by boutell

  • status changed from new to closed
  • resolution set to fixed

This is done (both stable and trunk, since a stable-branch client project needs it):

New aImageConverter::supportsInput($extension) method allows you to check whether aImageConverter can import a particular image format on this system. Mainly used to check for pdf support:

if (aImageConverter::supportsInput('pdf')) { ... }

You can pass:

gif, jpg, jpeg, png, bmp, ico, pdf (pdf always reports false if ghostscript is not available) and, if you have the netpbm utilities, other well known file extensions supported by netpbm.

This method can of course be fooled by broken installations in which the netpbm utilities or ghostscript are present but not working.

Lack of support for bmp and ico is neither a bug nor uncommon.

For performance reasons the result is cached for 5 minutes. Keep that in mind if you make system changes such as installing netpbm and ghostscript and see no immediate difference.

Note: See TracTickets for help on using tickets.