MyBB Community Forums

Full Version: Image without [img] tags in posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey there.
I want my forum to convert urls ending in gif,png,jpg/jpeg to be converted into [ img ] tags

User Crazycat helped me with the following code:

Regular expression: 
(https?://[^ ]+\.(png|gif|jpeg|jpg))
<a href="$1"><img src="$1" /></a>

but now i got this:

[Image: 68747470733a2f2f692e696d6775722e636f6d2f...4d2e706e67]

how can i fix this? is it something about the theme im using?
Have you tried the Default theme?
yea same thing
You'd better provide us your forum url and a test account
thanks guys, really:

test
2weq12e2"

https://forum.fmportugal.net/
Well, I understand the trouble: it breaks images wich are included with mycode because the custom mycode is applyed after the message parsing.
Change the regular expression to [^"](https?://[^ ]+\.(png|gif|jpeg|jpg))
This is exactly what happens when you view a page that used the old method of manually coding the img tags. The mycode sees the URL and adds another set of tags. You are seeing the results of a double-tagged image.

[attachment=44123]
like this right? https://i.imgur.com/b0aWDLE.png

it dsnt work
Works on my dev forum. But if you disable the MyCode, I can't see what happens on your forum.
@zeus1921: Ctrl-F5 to refresh browser if needed.
@Crazycat
not sure if you can have one *and* the other. At least not here.

Good reference here. https://regex101.com/

Post with this content doesn't work completely. I've run out of time to continue testing.

https://www.thetreecenter.com/wp-content/uploads/variegated-liriope-2.jpg

[img]https://www.thetreecenter.com/wp-content/uploads/variegated-liriope-2.jpg[/img]
Pages: 1 2