I am storing my uploads in a separate folder and using separate table to save the location in database.

I have gone through WP_Image_Editor , wp_image_editor_gd and wp_image_editor_imagick .

I also tried wp_insert_attachment and wp_generate_attachment_metadata

Is there any way to create thumbnails for PDF, video, doc, RAR, and ZIP using these classes or any other classes / functions in wordpress ?

Please let me know, if I should provide more detail on it or any question you want me to answer to help me.

1 Answer 1


You're already looking in the right places. (And nowadays WordPress already supports PDF thumbnails through ImageMagick - code.)

To add a new thumbnail generator, you'll need to:

  • write a new WP_Image_Editor class that supports the file type or types you want - you'll want to extend the base class and override at least
    • test()
    • load()
    • supports_mime_type() - to match the content types of the files you want to preview
    • multi_resize() - this is the method called to generate thumbnails
  • hook the wp_image_editors filter, and in the hook implementation include your editor class (if you haven't already) and add the class name to the filtered list, with whatever priority you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.