Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Big Picture messing up your design? Install this Details »»
Big Picture messing up your design? Install this
Version: 1.00, by Dimitrix Dimitrix is offline
Developer Last Online: Oct 2004 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 04-04-2004 Last Update: Never Installs: 21
 
No support by the author.

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

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 07-17-2004, 08:32 AM
Taco John Taco John is offline
 
Join Date: Nov 2002
Location: ddddd
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #43  
Old 07-17-2004, 06:22 PM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works great for me thanks

however the drop down box seem to appear over the image after its been expanded - weird ?
Reply With Quote
  #44  
Old 07-23-2004, 01:08 PM
DB8 MissingLink DB8 MissingLink is offline
 
Join Date: May 2003
Location: Los Angeles, CA
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, bit too buggy. I'm clicking uninstall. But it's a great idea...
Reply With Quote
  #45  
Old 08-08-2004, 11:15 AM
Hotte@gun Hotte@gun is offline
 
Join Date: Apr 2004
Location: Cologne, germany
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
        }
    }
}
Then i modified the handle_bbcode_img_match

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" />';
	}
}
So i am able to send a special Image as notification that the Links isnt correct.

I will attach the GERMAN images at this post. Just put the to you /forum/images/misc/ folder (or whatever place you specified)
Reply With Quote
  #46  
Old 08-05-2005, 06:41 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #47  
Old 03-16-2006, 10:04 AM
sunny001 sunny001 is offline
 
Join Date: Feb 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #48  
Old 08-05-2006, 04:39 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #49  
Old 08-30-2006, 09:39 AM
snake-boy snake-boy is offline
 
Join Date: Jul 2004
Location: Bangkok
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 *** ===-->
-snake
Reply With Quote
  #50  
Old 11-22-2006, 08:12 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Replace the contents of that function with this:

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 may alter the $img_max_width and $img_max_height, to suit your needs. The script will take care of images which are greater than the specified limit, either in portrait or landscape mode. In other words and for the example shown in the code, it will replace images which are larger than 800x600 or 600x800, depending on which dimension is larger (width or height).

You need to create two small images, as shown here:



and



Put these images in your images/misc directory and you are done.
Reply With Quote
  #51  
Old 03-22-2007, 08:49 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


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. The time now is 10:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05720 seconds
  • Memory Usage 2,314KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete