Not planned Attachment Handlers & thumbnails

Xon

Well-known member
It would make extending the attachment system vastly easier if the attachment handler participated directly in generating a thumbnail and it's links. Especially if the thumbnail data from xf_attachment_data was moved to xf_attachment.

This would allow for 1 attachment to be attached to multiple pieces of content with different thumbnail policies.
 
Upvote 12
This suggestion has been closed. Votes are no longer accepted.
Roughly speaking, the short answer is that approach won't change. It's pretty fundamental to the system at this point. It's also reasonably important that we have content agnostic thumbnails for situations where we do (or situations where we might in the future) be displaying thumbs regardless of content type.

However, in XF2, we have taken steps to allow you to create custom behaviors with attachments more easily, notably the onNewAttachment and onAssociation methods in attachment handlers. These would generally be a point to generate a thumbnail based on your specific needs.
 
Great suggestion @Xon, thanks for posting! I've run into dev issues related to this, and it would be great to the attachment handler reworked a bit.
 
As Mike said, the attachment handler has been reworked. A lot really.

It’s a lot more flexible now. If you consider all of the additional bits that XFMG does, things like watermarking, custom thumbnails, detecting media needing to be transcoded, storing EXIF data. Aside from general improvements that were already there, a lot of this stuff was added to the attachment handler so that the flexibility was there for add ons like XFMG to be able to do its stuff without the frankly hacky approaches we had to resort to in the past.

I’m confident there’s enough flexibility now to cover most things.
 
We currently have 284,000 attachments on our site with 260,000 unique attachments. The number of duplicates ranges from 1 to 12 or so. They arise from people uploading the same file repeatedly to create attachments. Those stats reflect the current vBulletin usage of the site.

We intend to have much better re-use ability on our XenForo site and will have correspondingly more duplicate attachments. If we cannot get anything to handle the issue invisibly in the data management part, I will probably end up writing a cron job that will go through the database and de-duplicate the attachments on some regular basis. We would like to use the same attachments in multiple content types and as long as the display details are kept with attachment data rather than attachment (use) we will probably need to create an addon to support the multiple content types. I hope that the changes in XF2 will make this approach feasible with a lot less work than it would be with 1.5.
 
As Mike said, the attachment handler has been reworked. A lot really.

It’s a lot more flexible now. If you consider all of the additional bits that XFMG does, things like watermarking, custom thumbnails, detecting media needing to be transcoded, storing EXIF data. Aside from general improvements that were already there, a lot of this stuff was added to the attachment handler so that the flexibility was there for add ons like XFMG to be able to do its stuff without the frankly hacky approaches we had to resort to in the past.

I’m confident there’s enough flexibility now to cover most things.
Could you please expand on the custom thumbnail bit? Are there any improvements in XF2 in regards to displaying thumbnails in different dimensions in different categories or content types?
 
The attachment handler is much more flexible so each content type can add custom behaviours much easier than before; this includes creating custom thumbnails.
 
Would it also be possible to create custom thumbnails per category? An issue we have frequently encountered is that the optimal thumbnail dimensions depend upon the subject. i.e. a category about cars likely needs horizontal/landscape dimensions, while a category about books/movies likely needs vertical/portrait dimensions.
 
I set up our site for centroid thumbnails by cropping the image to the largest contained square before resizing. It does not satisfy everyone but it does avoid silly thumbnails with just a blank corner of the image. Keeping them square is helpful for formatting a message.
 
Back
Top Bottom