PDF thumbnail generation in WordPress – You may not need a plugin!

I was working on a WordPress website in which I needed to create thumbnails from PDF file uploads. As I  work with WordPress less frequently these day I was not aware of an amazing update and fact about PDF thumbnail generation in WordPress.

Thanks to the WordPress update page, every time you upload a PDF file through media library, different thumbnail sizes are generated for the same.  The thumbnail information could be retrieved using attachment functions.

For example, the function wp_get_attachment_metadata($attachment_id) would give an array of all sizes, something like this:

And wp_get_attachment_thumb_url() will get the full url of the thumbnail.

In order to work PDF thumbnail generation in WordPress you need to enable

So if you are looking for PDF thumbnails generation plugin you may need to look into the inbuilt functions first.

You may need to look at this post for more detailed post about PDF thumbnail generation and regeneration in WordPress.

Leave a Reply