Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Project U-232
Reply
  #1  
Old 10th December 2014, 13:32
nicukent nicukent is offline
Senior Member
 
Join Date: Sep 2009
P2P
Posts: 40
Thumbs up U-232 V2 Modifications Image Resize Mod
Add to stdhead beside the others :
Code:
<link type='text/css' rel='stylesheet' href='image-resize/resize.css'  />
<script type='text/javascript' src='./image-resize/jquery.js'></script>
<script type='text/javascript' src='./image-resize/core-resize.js'></script>
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 = "<img src=\"{$src}\" border=\"0\" alt=\"\" />";
            else
            $img = "<a href=\"{$src}\" onclick=\"return false;\"><img id=\"r{$id}\" border=\"0\" alt=\"\" src=\"{$src}\" ".($addclass ? "class=\"resized\"" : "")." style=\"width:{$new[0]};height:{$new[1]};\" /></a>";
            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.
Attached Files
File Type: zip image-resize.zip (22.8 KB, 17 views)
Reply With Quote
Reply

Tags
image , mod , modifications , resize , u232 , v2

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 03:51. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.