WordPress.org

Ready to get started?Download WordPress

Forums

WP Document Revisions
[resolved] Adding post thumbnail support (6 posts)

  1. bigspring
    Member
    Posted 1 year ago #

    Hi Ben,

    We've been using this plugin a bit recently and it's providing some excellent functionality. Many thanks!

    I have a query / bug report. Adding post thumbnail support is causing some issues, as when you set the post thumbnail for a document, the thumbnail is treated as a new version of the document you're adding it to.

    Seems like someone else (Iain Porter) reported it hereL http://ben.balter.com/2011/08/29/wp-document-revisions-document-management-version-control-wordpress/

    Do you know of a workaround / fix for the issue? I can't work it out from your replies on that post I'm afraid.

    http://wordpress.org/extend/plugins/wp-document-revisions/

  2. bigspring
    Member
    Posted 1 year ago #

    I've found the solution by reading through some other comments on the thread posted above, so hopefully it'll help someone else.

    Whilst in the loop, you need to query the post for any attachments and then foreach through the attachments using wp_get_attachment_image to get the actual image itself.

    It's a workaround, but works well for me and I love the fact that the document manager automatically creates post thumbnails for uploaded images.

  3. shortster
    Member
    Posted 1 year ago #

    The way you describe is for fetching the thumbnail, right?

    However, upon uploading the thumbnail, the document still gets overwritten with the thumbnail as a new revision. So this is only ok when you use this plugin for managing images, which is what you probably do bigspring?

    So, when using the plugin for documents (pdf's in my case), the question remains, how do we add thumbnail support without it being hijacked by the document revisions?

  4. bigspring
    Member
    Posted 1 year ago #

    That's right, I was talking about fetching the image.

    To summarise what I found about adding the post thumbnail - you can't add post thumbnail support as it will overwrite the actual download file itself.

    However, if the file you uploaded if a valid image type (jpg / gif / png) then a post thumbnail is actually created without you having to specifically set one. You can then use the wp_get_attachment_image function to return the post thumbnail that's silently created.

  5. Ben Balter
    Member
    Plugin Author

    Posted 1 year ago #

    Thumbnails are not fully supported right now. This is due to a limitation on how files are uploaded. Given the media upload experience, there's no (easy) way to know when a user intends to upload a thumbnail for a document, and when they intent to upload a new version. The workaround would most likely to be some sort of "add thumbnail" button, etc., which would bipass the normal logic of uploading a new version.

    If anyone would like to take a first pass at this, pull requests are always, more than welcome. I created an issue on GitHub to track the new feature ( https://github.com/benbalter/WP-Document-Revisions/issues/33) and will close this support thread for the time being.

  6. bigspring
    Member
    Posted 1 year ago #

    Thanks for letting me know.

    Although it's probably not intended, post thumbnail support (kind of) works if you're uploading an actual image as the document, you just need to make sure you use wp_get_attachment_image rather than the_post_thumbnail.

    Obviously doesn't work if you're uploading a non-browser compatible image (eg. TIF) or other file type (doc / xls / pdf / etc).

    Might be worth mentioning that on the documentation somewhere. It's not ideal, but will probably keep most people going until one of us has time to submit a pull request.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.