Can I attach a document (eg: PDF) but have a JPEG as a thumbnail?

Is there a built-in feature or plugin that allows you to attach a document to a post or page such that the actual attachment file is one thing (eg a PDF) but the thumbnail images are another (eg a JPEG)? CLARIFICATION: the thumbnail does not need to be automatically generated (it could be a separate upload)

The use case here is a document library, where you have a little screenshot of what that document looks like but when you click the attachment, you can download the original document.

Related posts

Leave a Reply

5 comments

  1. Basic HTML?

    <a href="your.pdf">
    <img src="image.jpg" />
    </a>
    

    When you insert and image there is a field for the url called Link URL, you can just put your download url there.

    Please at least explain the down vote, I’m pretty certain this answers the OP’s question.

  2. WP-Filebase ended up being the free plugin solution we went with. This is actually a pretty cool plugin with a lot of power under the hood, though the interface is far from slick. When you upload any kind of document, you have the option to go to an “Advanced” upload form, which allows you to upload a separate thumbnail for the document. Then, when you decide to list the document, whether using shortcode, or automatically linking the doc to a page, you’ll see the thumbnail instead. Unfortunately, no ability to generate / manipulate / scale the thumbnail unlike the native Media upload process. Still, it’s a useful tool with some basic Document Management features that make it a good fit for small DMS requirements.

  3. WordPress already have the mechanism. We solve this by adding support for post-thumbnail (featured image) for attachments, and handle the representation for each file as normally do for other post types. (if has post thumbnail: the_post_thumbnail() etc etc.) Just add to functions.php:

    function entex_add_attachment_support(){
          add_post_type_support('attachment', 'thumbnail');
    }
    add_action('after_setup_theme', 'entex_add_attachment_support');
    

    Make shure to make the template files to look for the thumbnail, or filter in by hooks. There are plenty of ways to implement this solution. It feels a little confusing at the beginning to have featured image for an image, but its really handy for many objectives. You can also filter in to “read” this in Library table etc etc.