MyBB Community Forums

Full Version: [1.1.2] Resize Image without JS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I don't know if someone have do that, i don't find it Toungue

in inc/functions_post.php find
$message = preg_replace("#\[img\](https?://([^<>\"']+?))\[/img\]#i", "<img src=\"$1\" border=\"0\" alt=\"\" />", $message);
and replace with
$message = preg_replace("#\[img\](https?://([^<>\"']+?))\[/img\]#esi", "parse_image('$1')", $message);

Now in same file find
function dolist($message, $type="")
and add before
function parse_image($image)
{
	$image = str_replace( " ", "%20", $image );
	
	$maxwidth = 580;
	$img_info = getimagesize($image);
	$alt = "Clicca per ingrandire!";
 
	if ($img_info[0] >  $maxwidth)
	return "<font size=\"1\"><strong>$alt</strong></font>\n<a href='$image' target='_blank'><img width='$maxwidth' src='$image' border='0' alt='$alt' /></a><br />";
 
	return "<img src='$image' border='0' alt='Immagine non Disponibile' title='*' />";

}

Bye Cool
Vendor 1.2.9 is doesn't