Is there a way to disable external images?

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
charly65
Registered User
Posts: 10
Joined: Tue Dec 21, 2010 4:55 pm

Is there a way to disable external images?

Post by charly65 » Tue May 29, 2018 5:40 pm

Hi there,

I'd like to completely disable external images in my forum,
so basically disable the creation and interpretation of the [ img ] bbcode.
(Some users are smart enough to type [ img ] url [ /img ] manually.)
  • the [ img ] tag should not be available in the editor
    (or - if this cannot be achieved - then I'd like it to behave like the [ url ] tag)
  • no <img src="external url"> tags should ever be created
This should work for existing posts in the database (upgraded since phpBB 3.0.5) as well as new posts.
(I've noticed the [ img ] tag seems to be processed differently these days.)

The idea is not to have any external resource used to display my site.

Clickable urls and uploaded attachments are fine and should be used.

Any ideas on how to achieve this?
I'm fine with doing code changes if that cannot be achieved through settings,
just point me to the right place, please.
I've tried some changes in
includes/functions_content.php
includes/functions_posting.php
includes/bbcode.php
with limited success.

many thanks
Charly

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50916
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Is there a way to disable external images?

Post by stevemaury » Tue May 29, 2018 6:00 pm

ACP, Permissions, Group forum permissions, Registered users group, All forums, Advanced permissions, Content tab, Can use [img] BBCode tag, No.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

charly65
Registered User
Posts: 10
Joined: Tue Dec 21, 2010 4:55 pm

Re: Is there a way to disable external images?

Post by charly65 » Tue May 29, 2018 6:56 pm

@steve: thanks a lot for the fast response - however, it solves only 2 of the 3 requirements:
  • IMG-Button in Editor is missing - fine ✓
  • [ img ] tag is complained about if manually entered in Editor - fine ✓
  • External images in previously existing posts still display - that's bad.
Any idea?

many thanks
Charly

PS: rather than having to edit this for many exisitng (and every new) forum(s), I'd rather do one change in a central place - if necessary in the code.
I guess this would have to be either where the permission is read from the database or where the actual interpretation of the [ img ] tag takes place.

User avatar
KevC
Support Team Member
Support Team Member
Posts: 69452
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Is there a way to disable external images?

Post by KevC » Tue May 29, 2018 7:12 pm

What's the bigger picture of what you're trying to do? Posting images is often the lifeblood of a forum. It makes it more interactive for the members.
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"

charly65
Registered User
Posts: 10
Joined: Tue Dec 21, 2010 4:55 pm

Re: Is there a way to disable external images?

Post by charly65 » Tue May 29, 2018 7:18 pm

KevC wrote:
Tue May 29, 2018 7:12 pm
What's the bigger picture of what you're trying to do?
I don't want my site to depend on (the existence/the content of) other sites.

User's can upload images if they wan't to, that's fine and highly appreciated.
But images on foreign sites (eg. image hosters) tend to get lost over time.

Also it's part of the privacy settings. Loading external images from foreign
sites will leave traces from my users on foreign servers (Apache logs et al)
which I'm trying to avoid.

Charly

User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Is there a way to disable external images?

Post by canonknipser » Tue May 29, 2018 7:29 pm

Try this extension: https://www.phpbb.com/customise/db/exte ... s_as_link/
No need to struggle with the core code
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

charly65
Registered User
Posts: 10
Joined: Tue Dec 21, 2010 4:55 pm

Re: Is there a way to disable external images?

Post by charly65 » Tue May 29, 2018 7:58 pm

canonknipser wrote:
Tue May 29, 2018 7:29 pm
Try this extension: https://www.phpbb.com/customise/db/exte ... s_as_link/
Thanks Frank. Sound's promising, but it doesn't work in my forum for whatever reason.
It's a 3.2.2, upgraded several times from early 3.0.x.
The only other extension installed is board3 portal, but even when I decactivate it,
this one doesn't show up. I can activate/deactivate it, but it never shows up in the Extension tab.

Charly

charly65
Registered User
Posts: 10
Joined: Tue Dec 21, 2010 4:55 pm

Re: Is there a way to disable external images?

Post by charly65 » Tue May 29, 2018 8:04 pm

Never mind - I found it. It doesn't show up in Extensions.

User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Is there a way to disable external images?

Post by canonknipser » Tue May 29, 2018 8:09 pm

Yes, it's setting is in "Post settings":
Screenshot_20180529_220837.png
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50916
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Is there a way to disable external images?

Post by stevemaury » Tue May 29, 2018 9:28 pm

charly65 wrote:
Tue May 29, 2018 6:56 pm
@steve: thanks a lot for the fast response - however, it solves only 2 of the 3 requirements:
  • External images in previously existing posts still display - that's bad.
You never said that. You said you did not want them "created".

PS: rather than having to edit this for many exisitng (and every new) forum(s), I'd rather do one change in a central place - if necessary in the code.
I guess this would have to be either where the permission is read from the database or where the actual interpretation of the [ img ] tag takes place.

All you have to do is to copy the permissions of an existing forum to the new forum.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

charly65
Registered User
Posts: 10
Joined: Tue Dec 21, 2010 4:55 pm

Re: Is there a way to disable external images?

Post by charly65 » Tue May 29, 2018 10:26 pm

stevemaury wrote:
Tue May 29, 2018 9:28 pm
You never said that. You said you did not want them "created".
Well, I thought I did (perhaps not clear enough since english isn't my mother tongue):
charly65 wrote:
Tue May 29, 2018 5:40 pm
so basically disable the creation and interpretation of the [ img ] bbcode.
charly65 wrote:
Tue May 29, 2018 5:40 pm
This should work for existing posts in the database (upgraded since phpBB 3.0.5) as well as new posts.
Anyhow, the extension Frank recommended basically does the job.

I would still like to add a change to the code (or a single, central place in configuration)
that removes the 'Image' Button from the Editor. So the final question is:
Where is the permission for IMG read from the database so I can basically change one
line of code there to set the permission to false regardless of what the database says?

Thanks again.
Charly

User avatar
John connor
Registered User
Posts: 2330
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: Is there a way to disable external images?

Post by John connor » Tue May 29, 2018 10:46 pm

To remove the [IMG] BBcode it's under Posting | BBcodes in the ACP. Go there, find it and delete it. In fact, once you click the Posting tab, the BBcodes are right there.

Did you change the group permissions so that users can't upload external images?


Edit- Well crap. I don't see an [IMG] BBcode. But if you changed the permissions like mentioned there shouldn't be an issue.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66897
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Is there a way to disable external images?

Post by Lumpy Burgertushie » Tue May 29, 2018 11:41 pm

if you turn off the permission for the registered user group to use the img bbcode then nobody will be able to use it even by typing it in.

the only way I can think of to remove all of the img bbcodes that are already there would be to run a query on the database post table to remove them.

I have no idea what that query would have to be.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
larkyv
Registered User
Posts: 57
Joined: Wed Feb 21, 2018 3:45 pm

Re: Is there a way to disable external images?

Post by larkyv » Wed May 30, 2018 12:56 am

And.... that might have major repercussions with the database and the software.

User avatar
Freitag
Registered User
Posts: 143
Joined: Mon Jul 11, 2005 10:17 pm

Re: Is there a way to disable external images?

Post by Freitag » Wed May 30, 2018 5:43 am

It almost sounds like you need an automated way to turn an img tag into a local reference. This might be a good "extension needed" request idea. On saving a post, scan for the img tag, if found, download the referenced image to the local store and change the img reference to local.

Yes, you will leave your servers fetch reference in the remote log file, but non of your users (other than the one that posted the link) will be in there.
No clever .sig here

Post Reply

Return to “[3.2.x] Support Forum”