plugin development - How to create thumbnail of different files?

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

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.

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.

Share Improve this question edited Jul 12, 2019 at 9:01 Glorfindel 6093 gold badges10 silver badges18 bronze badges asked Jun 27, 2016 at 11:58 Prafulla Kumar SahuPrafulla Kumar Sahu 2631 gold badge4 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745326395a4622676.html

相关推荐

  • plugin development - How to create thumbnail of different files?

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

    7小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信