Solved: 6 Days, 18 Hours, 18 Minutes ago Image without [img] tags in posts
#1
Solved: 6 Days, 18 Hours, 18 Minutes ago
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?
Reply
#2
Solved: 6 Days, 18 Hours, 18 Minutes ago
Have you tried the Default theme?
Reply
#3
Solved: 6 Days, 18 Hours, 18 Minutes ago
yea same thing
Reply
#4
Solved: 6 Days, 18 Hours, 18 Minutes ago
You'd better provide us your forum url and a test account
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM
Reply
#5
Solved: 6 Days, 18 Hours, 18 Minutes ago
thanks guys, really:

test
2weq12e2"

https://forum.fmportugal.net/
Reply
#6
Solved: 6 Days, 18 Hours, 18 Minutes ago
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))
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM
Reply
#7
Solved: 6 Days, 18 Hours, 18 Minutes ago
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.

   
Reply
#8
Solved: 6 Days, 18 Hours, 18 Minutes ago
like this right? https://i.imgur.com/b0aWDLE.png

it dsnt work
Reply
#9
Solved: 6 Days, 18 Hours, 18 Minutes ago
Works on my dev forum. But if you disable the MyCode, I can't see what happens on your forum.
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM
Reply
#10
Solved: 6 Days, 18 Hours, 18 Minutes ago
@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]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)