• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Remove =full from ATTACH image tag lines

RSI

Active member
#1
Hi,

Does anyone know of a way to modify the code in one of the templates (I'm assuming the bb_code_tag_attach template or in one of the editor templates) that will remove the =full from the ATTACH line?

I had removed the insert full image inline button within the editor a long time ago, but from time to time I get a savvy user that knows how to add =full to it manually while within the post editor.

What I'm asking is there a way to make it take the below when they try to add it
Code:
[ATTACH=full]1234[/ATTACH]

And have it automatically change is back to the below when they try and save it?
Code:
[ATTACH]1234[/ATTACH]
Reason being is I only want the world (guests and bots) to see the smaller thumbnails to to reduce bandwidth and etc. when they view the pages. I only want people to see the larger ones when they are logged in and then click on them.
.
 

Brogan

XenForo moderator
Staff member
#2
Reason being is I only want the world (guests and bots) to see the smaller thumbnails to to reduce bandwidth and etc. when they view the pages. I only want people to see the larger ones when they are logged in and then click on them.
You do that with permissions.

Remove the 'View attachments to posts' permission for the unregistered user group.
 

RSI

Active member
#3
You do that with permissions.

Remove the 'View attachments to posts' permission for the unregistered user group.
That only works with attachments that are not placed inline. All of the attachments are always inserted inline anyway via another mod I have installed.

I want guests to be able to see the images, but only the thumbnails. I have that size set to a max smaller size so what guests and everyone sees inline are the small thumbnail sizes until logged in users click on them to expand.

That's why I was asking if there is an easy way to modify one of the templates to stop people from being able to manually add =full
.
 

Brogan

XenForo moderator
Staff member
#4
I want guests to be able to see the images, but only the thumbnails.
That's what the permission does, regardless whether attach=full is used.

If the add-on you are using overrides that, then it should be updated to respect the permissions.
 

RSI

Active member
#5
That's what the permission does, regardless whether attach=full is used.
Yes, and the problem is when someone uses attach=full when the image is placed inline guests still see that full size image whether that permission is set or not and I have always had it set correctly long before I installed that other add-on.

Anyway, I played around with the bb_code_tag_attach template and figured out a way to make it always display the small thumbnail even when they use =full but that's not what I want because it can cause another issue. Looks like it will probably take a post editor template mod or maybe even a combination of both to automatically remove the =full during save :(
.
 

Brogan

XenForo moderator
Staff member
#6
Yes, and the problem is when someone uses attach=full when the image is placed inline guests still see that full size image whether that permission is set or not and I have always had it set correctly long before I installed that other add-on.
That is incorrect. Either your permissions are not set correctly or a buggy add-on is involved.

You can test the behaviour yourself with this post: https://xenforo.com/community/threads/xenforo-media-gallery.86897/

The image is an attachment and is displayed using =full.

Use an incognito browser session or log out and you will note that you cannot view the full image as a guest.
 

RSI

Active member
#8
That is incorrect. Either your permissions are not set correctly or a buggy add-on is involved.
I did it here and logged out and cleared my cache and it is working like you said. It's been that way since day one so I have no clue as to what's causing it. Unless.., I don't think the fact I'm on Cloudfare could be the issue, but wait.... that could be it due to a page rule, etc.

If it is due to Cloudfare and they way it's setup then I still need what I was requesting because I don't want to change the other.
.
 

RSI

Active member
#9
That's it, it's was Cloudfare. I turned off the page rule where is caches the entire attachment directory then I cleared the cache and now when viewing pages as a guest the full images don't show anymore.

The problem is I want the entire attachment directory cached because is greatly pads and speeds up image loading world wide so I still need to figure out a way to do what I was asking. If anyone knows a way via a template mod please let me know.

Thanks...
.
 

RSI

Active member
#10
I figured out a quick and dirty way to eliminate all full size images from being displayed inline by modifying the bb_code_tag_attach template.

I changed the below...
Code:
<xen:elseif is="{$canView} AND {$FULL}" />
To this...
Code:
<xen:elseif is="{$canView} AND {$thumbnailUrl}" />
Then I modified the last line with a url link to the login page so when a guest clicks on the inline thumbnails it directs them to that page.
Code:
<xen:else />

   <a href="http://mydomain.com/login/" target="_blank"><img src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" class="bbCodeImage" /></a>
 
</xen:if>
This really isn't the best way, but it works for now. What I wanted is a way to completely disable full size images from being displayed inline period and even for logged in members and not just when guest viewing. Even if CloudFare wasn't overriding that permission they would still display when users are logged in. Removing the insert Full Image button in the post editor took care of it 99% of the time except for the occasional savvy members who know how to manually add =full to the attachment BBCODE.

Anyway, at least now when guests are viewing and they try to click on the inline thumbnails they get redirected and when logged in members click on them they expand like normal with the GD image library viewer, but they will only see the thumnail size before doing that even if the =full is added to the BBCODE now.

You guys really need to figure out a way so everyone can disable full sized attachment images from being displayed inline if and when they want to. Most of my members will only click and view the larger images maybe one or two times at the most. So that means when they come back the next day and or etc. their browsers have to keep redownloading those full size images when the pages load. I made the thumbnail size like 300px by 300px so they are large enough that they can been seen without having to click on them to expand every time unless you want to. Not only that, but more and more people are starting to use CDN's and that permission thing is an issue anyway and gets overridden when the attachment directory is cached. At least that's what happens with CloudFare.
.
 
Last edited: