Idea for better styling with IMG tags

Submitted by Anonymous on Tue, 07/17/2012 - 10:08
Written by
mrGTB

I've done something today and wondering what you think about this for UseBB as a whole, just for some better presentation of certain things like external IMG images displayed. It can also help show-up 1px images people post leading to PHP files (spammers inserting them) in posts. You'd see them because of border added, even 1px transparent images.

In the file: sources/functions.php
This line was changed.

				// [img]image[/img]
"#\[img\]([\w]+?://[\w\#\$%&~/\.\-;:=,\?@\[\]\+\\\\\'!\(\)\*]*?)\[/img\]#is" => ( $links ) ? '<img src="\\1" alt="'.$lang['UserPostedImage'].'" />' : '\\1',

To this adding a style class.

				// [img]image[/img]
"#\[img\]([\w]+?://[\w\#\$%&~/\.\-;:=,\?@\[\]\+\\\\\'!\(\)\*]*?)\[/img\]#is" => ( $links ) ? '<img src="\\1" class ="imgtagsborder" alt="'.$lang['UserPostedImage'].'" />' : '\\1',

Then this CSS added to the stylesheet extra.

.imgtagsborder {
padding: 4px;
background-color: #FFF;
border: 1px solid silver;
}

The result is this with all external images now show.
http://community-forums.co.uk/topic-post23.html#post23

That is a good idea, strange nobody thought of it before. I made this small change in the v1.0 code.

Thanks.