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.
Hi everyone!

This is one mine MyCode which could be useful for some of you.

Point is that image is shown in posts like when you use
[img][/img]

tags but you don't need to use them.
If your url ends with some of common image extensions, it will be automatically shown as image in post.
Please note: that you will need new MyCode code for each extension so I prefer giving them titles by extension.
Here are few most common extensions code:
New MyCodes will be separated by lines (hr tags):

Firstly go to ACP -> Configuration -> MyCode -> Add new MyCode



Title: jpg

Regular Expression:
\[url\](.*?).jpg\[/url\]

Replacement:
<img src="$1.jpg" />

Or if you want for image to also become a url to original image:

Replacement:
<a href="$1.jpg"><img src="$1.jpg" /></a>



Regular Expression:
\[url\](.*?).png\[/url\]

Replacement:
<img src="$1.png" />



Regular Expression:
\[url\](.*?).jpeg\[/url\]

Replacement:
<img src="$1.jpeg" />



Regular Expression:
\[url\](.*?).gif\[/url\]

Replacement:
<img src="$1.gif" />
I don't understand the usage since MyBB already has img and url tags.
Yes, it has. But this code will show image link like image directly in place of url
(2017-12-11, 03:48 PM)Ikerepc Wrote: [ -> ]Yes, it has. But this code will show image link like image directly in place of url

You can certainly do that with the existing tags URL outside of IMG. 

You shouldn't make every image link anyways.   Anyone can right click an image to view it.  If they are all links that's bad SEO and annoying imho to visitors.

The link will just go to the plain image.  Not really much of a point to do that.
See, if it is not useful for you, you don't need to use that Smile
looks like this tutorial idea came from a user asking for this requirement. I'd appreciate the work.
Yes. And I remember that I had that kind of request before so I decided to post it here if it can help to someone else too.
does is working On the last version of mybb because i try and is not working is just show a link Clikable