Re-using attachments

swatme

Well-known member
ok im on xf 1.2
i suggest to have a re-use of attachment files

example:
you upload an image attachment on thread named "my beautiful wife"
so its now ok...
now you realize, you also need to post the same picture in another thread named "sexy wife".

instead of reuploading the same file which consumes space, why not reuse it instead?
Code:
[attach]123456[/attached]


currently if you just copy "image file url" and use img tag
it will only show when your login, but for unregistered it will
not show the thumbnail.

i hope image reuse is avaialble
 
Upvote 16
What I have done on my forum is to edit the bb_code_tag_attach template so that attach codes can be viewed in any post.

Instructions:

1) Delete contents of bb_code_tag_attach template
2) Add the following code to the bb_code_tag_attach template

Code:
<img src="{xen:link attachments, $attachment}" alt="{$attachment.filename}" class="bbCodeImage LbImage" />
Hi @AndyB what do you exactly mean by "so that attach codes can be viewed in any post"? What will change with this template edit? I know that as a guest I am not able to view images in some forums here and they appear as thumbnails. Do I need to edit the template you mentioned to cancel this restriction? I actually thought this is only a matter of setting up the permissions who can view attachments. Am I wrong here?
 
Hi @AndyB what do you exactly mean by "so that attach codes can be viewed in any post"? What will change with this template edit? I know that as a guest I am not able to view images in some forums here and they appear as thumbnails. Do I need to edit the template you mentioned to cancel this restriction? I actually thought this is only a matter of setting up the permissions who can view attachments. Am I wrong here?

On the default installation of a Xenforo forum, you cannot view attached images in other than the original post. If you copy the attach code (or quote a post with an attachment) to another post it will show up as a link. In order to override this behavior and have it show as an image, you need to edit the bb_code_tag_attach template as I described.

Here is an example of an attach code:

[ATTACH=full]56705[/ATTACH]

Permissions can be set to prevent visitors from seeing attached images, but this thread discussion is not about that restriction.
 
What I have done on my forum is to edit the bb_code_tag_attach template so that attach codes can be viewed in any post.

Instructions:

1) Delete contents of bb_code_tag_attach template
2) Add the following code to the bb_code_tag_attach template

Code:
<img src="{xen:link attachments, $attachment}" alt="{$attachment.filename}" class="bbCodeImage LbImage" />

By doing what you suggested I can not use anymore thumbnails and all thumbnails were displayed as full images. So I don't recommend to do this :(
 
By doing what you suggested I can not use anymore thumbnails and all thumbnails were displayed as full images. So I don't recommend to do this :(

This is how I want my forum to work. If you wish to use both thumbnails and full size images, you can use my example but modify the code to do this.
 
You can re-use an attachment.

Just embed it as an image like this:

Code:
[IMG]http://xenforo.com/community/attachments/73830/[/IMG]

AN ORIGINAL UPLOADED HERE:

blueavi.webp
 
RE-USED:

73830
 
I also want to reuse, but I wanted remember that the attachments are more than just the images. The RAR, ZIP, PDF, etc. are also attachments.
 
The issue in "reused" is its not a bbcode reference to the attachment. Guests have no permission to view the attachment and linking the image http://xenforo.com/community/attachments/73830/ will return nothing to those with no permission rather than a thumbnail as desired.

The attachment implementation returns a thumbnail rather than the full image for those without permission. If this is extended to work in other posts it would continue to do so.
 
You can use this add-on:
http://xenforo.com/community/resources/wmtech-attachment-manager.1364/

It allows to reuse (or delete) all attachments and checks permission, so only attachments which can be viewed by all members are allowed to be reused.

Also you can use one of the add-ons which disable the attachments permissions, so all attachments can be viewed by anyone.
Does this addon works with others files format besides images? (zip, pdf, etc.._)
 
On the default installation of a Xenforo forum, you cannot view attached images in other than the original post. If you copy the attach code (or quote a post with an attachment) to another post it will show up as a link.
On top of this, I've discovered that if you upload an attachment and then insert it as full (or thumb, I think) then you go to the BB Code Editor and then switch back to the Rich Text Editor, it turns it into a link as if you quoted it and your pic won't even show up in your original post.
 
On top of this, I've discovered that if you upload an attachment and then insert it as full (or thumb, I think) then you go to the BB Code Editor and then switch back to the Rich Text Editor, it turns it into a link as if you quoted it and your pic won't even show up in your original post.

I'm not able to reproduce.
 
800px-Coral_Outcrop_Flynn_Reef.webp
huh ok. Well maybe it had somethign to do with switching back and forth and then using the preview button, made it look like it wasn't going to work
 
Top Bottom