Auto-show image links as pictures without using [img] tag in messages

Started by Kermit, July 11, 2010, 05:07:13 AM

Previous topic - Next topic

Biology Forums

Quote from: Kermit on June 12, 2012, 11:58:02 AM
Quote from: Liam_michael on June 11, 2012, 10:47:51 PM
Is there a way to automatically have the [ img ] and [/ img] inserted between an image link?

What for ? If images would be shown without insterting those tags in the post

Because if I don't add [ img ] to the link, it won't obey the settings in the admin section that asks how large a picture can be. I've set mine to 350 px.


Guy Verschuere

Nice trick!

But: I notice that this one breaks all old topics as it is used for every view. Topics with picture with IMG tags are also processed.
Is there a way to have this trick in /Sources/Post.php?

rallepralle

Quote from: Kermit on July 11, 2010, 05:07:13 AM
For nCode Image Resizer Mod users,they need to replace with this one

Code (replace) Select
if (substr($message, 0, 1) == ' ')
$message = ' ' . substr($message, 1);

if (strpos($message, '<a href') !== false && !strpos($message ,'quote'))
{
    //show up images without inserting them between [img] tags ;)
$message = preg_replace('~<a href="(.*?)(\.(?i)(jpg|jpeg|gif|png|bmp))"(.*?)>(.*?)(\.(?i)(jpg|jpeg|gif|png|bmp))</a>~i', '<img src="$1$2" alt="" onload="NcodeImageResizer.createOn(this);"/>', $message);
}


What does 'img src="$1$2"' mean? I want to understand what it means because I modify the code so it can also display videos without adding a tag to the link.

Advertisement: