nicukent |
10th December 2014 13:32 |
U-232 V2 Modifications Image Resize Mod
1 Attachment(s)
Add to stdhead beside the others :
Add to include/bbcode_functions.php :
Code:
function scale($src)
{
$max = 350;
if (!isset($max, $src))
return;
$src = str_replace("", "%20", $src[1]);
$info = @getimagesize($src);
$sw = $info[0];
$sh = $info[1];
$addclass = false;
$max_em = 0.06 * $max;
if ($max < max($sw, $sh)) {
if ($sw > $sh)
$new = array($max_em . "em", "auto");
if ($sw < $sh)
$new = array("auto", $max_em . "em");
$addclass = true;
} else
$new = array("auto", "auto");
$id = mt_rand(0000, 9999);
if ($new[0] == "auto" && $new[1] == "auto")
$img = "";
else
$img = "";
return $img;
}
Replace old img pregs:
Code:
//--img
if (stripos($s, '[img') !== false) {
$s = preg_replace_callback("/\[img\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "scale", $s);
// [img=http://www/image.gif]
$s = preg_replace_callback("/\[img=(http:\/\/[^\s'\"<>]+(\.(gif|jpg|png)))alt=\"\"\]/i", "scale", $s);
}
Unzip and Upload image-resize to root.
|