WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by stianlik v2.2.0

PDF Thumbnails

This plugin generates a thumbnail everytime you upload a PDF attachment. Generated thumbnail is an image of the first page in uploaded document.

PDF Thumbnails

The facts

Rating
4.6★ from 9
Active installs
1k+
Price
Free
Last updated
24 Oct 2016
Added
Apr 2014
Tested up to
WP 4.6.30
Downloads
35,262

Our analysis

AI-assisted

PDF Thumbnails is a WordPress plugin that generates a thumbnail image from the first page of a PDF document every time a PDF is uploaded. The generated thumbnail is named according to the uploaded document's filename and can be used like a featured image for PDF attachments.

The plugin integrates with the media manager and provides a shortcode to display a thumbnail linking to the uploaded PDF. Users can specify various attributes for the shortcode, such as attachment ID and thumbnail size. It is suitable for users who want to enhance their media library with visual representations of PDF files.

Best for: This plugin is best for WordPress users who frequently upload PDF documents and want to display them visually.

What it does well

  • Generates thumbnails from the first page of uploaded PDFs
  • Thumbnails can be used as featured images for PDF attachments
  • Includes a shortcode for displaying PDF thumbnails

Where it falls short

  • Integration with the JavaScript media API is not implemented
  • Requires page reload to see generated thumbnails after upload

Verdict

PDF Thumbnails provides a straightforward solution for generating and displaying PDF thumbnails, though it has some limitations regarding real-time updates and JavaScript integration.

From the developer

stianlik's own description of PDF Thumbnails, lightly tidied.

This plugin hooks into the media manager and generates a thumbnail everytime a
PDF is uploaded. Generated thumbnail is an image of the first page in the
uploaded document and is named PDFNAME-thumbnail, where PDFNAME is replaced
by uploaded document filename.

Generated thumbnails are equivalent to featured
images
so that common thumbnail
functions like get_post_thumbnail_id() can be used for PDF attachments. See
Post Thumbnails for information
on how you can use thumbnails efficiently.

Integration with the javascript media API is not yet implemented, therefore, you
may need to reload the page before you can see generated thumbnail after an
upload.

Shortcodes

It is possible to display a thumbnail linking to an uploaded PDF using the [pdf_thumbnails_link]
shortcode. The following attributes are supported:

Example 1: Display link to PDF with ID = 172 using default thumbnail size

[pdf_thumbnails_link id="172"]

Example 2: Display link to PDF with ID = 172 using thumbnail size (default 150×150)

[pdf_thumbnails_link id="172" size="thumbnail"]

Thanks to mirgcire for providing the first
version of the [pdf_thumbnails_link] shortcode.

Developer API

In most cases it should be sufficient to use built-in thumbnail functions from
the WordPress API (get_post_thumbnail and similar). If you need to modify the
way thumbnails are generated, you can override image generation with
the pdf_thumbnails_generate_image_blob filter.

Example 1: Increase resolution for all generated PDF thumbnails

// $blob is the current image blob (defaults to null, can be used for chaining)
// $filename is the PDF filename
add_action('pdf_thumbnails_generate_image_blob', function ($blob, $filename) {
    $imagick = new Imagick();
    $imagick->setResolution(200,200);
    $imagick->readImage($filename);
    $imagick->setIteratorIndex(0);
    $imagick->setImageFormat('jpg');
    return $imagick->getImageBlob();
}, 10, 2);

It is possible to modify generated thumbnail links using the pdf_thumbnails_link_shortcode
filter. The following attributes are available:

Read the full description on the official page →

Tagged as