The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Big Picture messing up your design? Install this Details »» | |||||||||||||||||||||||||||
Big Picture messing up your design? Install this
Developer Last Online: Oct 2004
What does this hack do?
This hack will check if an image that a member of your forums has inserted in the post is below the allowable width. If not, the image will be replaced with a small button that basicly says "Image too big, click here to view". When clicked, the image will appear right in the post but without messing up your forum design one bit. Example? Working example can be found here: http://www.designworldwide.com/forum/t35-s.html (note: This is on VB2 but should have the same effect. If you installed it on Vb3, send me a link so I can post it here) VB2 thread if anyone wants it: https://vborg.vbsupport.ru/showthread.php?t=63429 Please post any bugs/comments/questions here. While making this hack I had some trouble with reg. expressions and had to go around them a little (php developers can see this). Ive been coding for years now but never had the need to learn those Image: https://vborg.vbsupport.ru/showthrea...725#post495725 (Image now included in ZIP) Anyways, Enjoy! Dimitry Show Your Support
|
Comments |
#42
|
|||
|
|||
Clicking uninstall... This thing works to a degree, but too many bugs and it really slows down the thread loading for some reason.
Thanks anyway. |
#43
|
|||
|
|||
works great for me thanks
however the drop down box seem to appear over the image after its been expanded - weird ? |
#44
|
|||
|
|||
Yeah, bit too buggy. I'm clicking uninstall. But it's a great idea...
|
#45
|
|||
|
|||
Another way to check if the file linked exists ins another function (i think you can use it in other linking, too)
Code:
//this function checks a link at 404 error function is_404($url) { $a = parse_url($url); $sock = fsockopen($a['host'], empty($a['port']) ? 80 : $a['port']); if(!$sock) { return true; } else { preg_match("'\w+://[^/]+(.*)'", $url, $matches); fputs($sock, 'HEAD ' . $matches[1] . " HTTP/1.0\r\nHost: " . $a['host'] . "\r\n\r\n"); preg_match("'(\w+)/([^ ]+) (\d+) (.*)'", $data = fread($sock, 4096), $matches); fclose($sock); if($matches[3] == '404') { return true; } else { return false; } } } Code:
// this is only called by handle_bbcode_img function handle_bbcode_img_match($link) { // IMPORTANT - REPLACE THE FOLLOWING 2 VARIALBS WITH YOUR INFORMATION $img_replacement = "images/misc/button_imagebig.gif"; // This is the button/image that will be displayed instead of the big image. $img_max_width = 600; // This is the maximum width that an image is allowed to be viewed safely. $link = strip_smilies(str_replace('\\"', '"', $link)); // remove double spaces -- fixes issues with wordwrap $link = str_replace(' ', '', $link); if('!is_404') { $img_width = @getimagesize($link); if ($img_width[0] > $img_max_width) { srand((double)microtime()*1000000); $number = rand(10,100); $inp_string = "<a href=\"javascript:toggle_imgview('bigimg".$number."')\"><img src=\"".$img_replacement."\" alt=\"\" border=\"0\" /></a><br />\n"; $inp_string .= "<div style=\"position:absolute;display:none;z-index:1;\" id=\"bigimg".$number."\"><img src=\"".$link."\" border=\"0\" alt=\"\" /></div>"; return $inp_string; } else { return '<img src="' . $link . '" border="0" alt="" />'; } } else { return '<img src="/cg/images/misc/404.gif" width="150" height="50" border="0" alt="Bitte editieren Sie diesen Link" />'; } } I will attach the GERMAN images at this post. Just put the to you /forum/images/misc/ folder (or whatever place you specified) |
#46
|
||||
|
||||
Kinda a lame hack IMO. It should check the users resolution before deciding to shrink the image or not. Basically this hack doesnt make sense for anybody that has a liquid layout and the width of your forum depends solely on the users resolution.
|
#47
|
|||
|
|||
Hi,
I just installed it, but vB 3.5.4 looks a little bit different. I had to change the code in includes/class_bbcode.php. The exact code that has to be replaced it there, but when trying to add a new thread I'm forwarded to an empty page. Any idea about it'll work with vB 3.5.4? Sven |
#48
|
|||
|
|||
Dimitrix, I am using this hack and even though it works as it should (I have modified it to suite my needs), I am still occasionally running in the need for a delay. It happens only when there are too many missing pictures in a post.
Could you please let me know on how you implemented the delay you mentioned here: https://vborg.vbsupport.ru/showpost....1&postcount=27 |
#49
|
|||
|
|||
A friend of mine sent me this code that invision users can use to resize images inline (images hosted elsewhere obviously).
Is there ANY way we can get this to work as a custom bb code for vbulletin? I don't understand the code, but I'm sure someone with more coding skills can figure it out. Here's the code: Code:
<!--=== *** START RESIZED IMG *** ===--> <script> tds=document.getElementsByTagName("td"); for (p=0; p<tds.length; p++) { if (tds[p].className.match(/post[0-4]/i)!=null) { tds[p].innerHTML=tds[p].innerHTML.replace(/\[img=([0-9]+?(?x|%)?),([0-9]+?(?x|%)?)\](.*?)\[\/img\]/ig,"<img src='$3' width='$1' height='$2' style='display:inline'>"); } } </script> <!--=== *** END RESIZED IMG *** ===--> |
#50
|
|||
|
|||
I am running vB 3.0.14, so I know this works in that version, I am not sure how 3.5 or 3.6 differ from the older versions, but here is a simpler method to handle this issue.
In your functions_bbcodeparse.php file, find this: Code:
function handle_bbcode_img_match($link) Code:
function handle_bbcode_img_match($link) { $img_max_width = 800; // <-- This is the maximum width that an image is allowed to be viewed safely. $img_max_height = 600; // <-- This is the maximum height that an image is allowed to be viewed safely. $link = strip_smilies(str_replace('\\"', '"', $link)); // remove double spaces -- fixes issues with wordwrap $link = str_replace(' ', '', $link); if ($imginfo=@getimagesize($link)) { if (($imginfo[0] > $imginfo[1] and ($imginfo[0] > $img_max_width or $imginfo[1] > $img_max_height)) or ($imginfo[0] < $imginfo[1] and ($imginfo[1] > $img_max_width or $imginfo[0] > $img_max_height)) or ($imginfo[0] == $imginfo[1] and ($imginfo[0] * $imginfo[1] > $img_max_width * $img_max_height))) { $inp_string="<a href=\"$link\" target=\"_blank\"><img src=\"images/misc/toobigimage.gif\" border=\"0\" alt=\"\"></A>"; return $inp_string; } else { return '<img src="' . $link . '" border="0" alt="" />'; } } else { if (!$allowimgsizefailure) { $inp_string="<img src='images/misc/notexistimage.gif'>"; return $inp_string; } } } You need to create two small images, as shown here: and Put these images in your images/misc directory and you are done. |
#51
|
|||
|
|||
Well after we run the above for a while, the delay it imposes on a page full of images make it undesirable.
I came up with a hack to check the images size during the posting of a message. If one image is larger than the specified file, then the message is not posted and an error is shown. If someone is interested, I can post it as a new hack, but since this is for vB 3.0.xx I am not sure if there is any interest. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|