Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

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
  #22  
Old 04-07-2004, 12:10 PM
wolfgang2 wolfgang2 is offline
 
Join Date: Apr 2003
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

a very nice idea.
Heard from it in the german vB-Forums and tried it.
But , unfortunately the hack did not work quite properly.
Esp. in Mozilla and Netscape the window with the picture did not open itself.
Also it is not working with IE5, only with IE 6.

The 2nd problem:
If there is a thread with many pictures u can not klick one of the samll replacements pics at once.
u have to wait until all pictures in the thread are loaded.
If u klick to early no picture will load properly anymore and the pics will open for example 1/ 3rd of its size.

But when these problems are dealed with then i might insatll again because its a good idea.
THX
Reply With Quote
  #23  
Old 04-07-2004, 08:14 PM
Dimitrix Dimitrix is offline
 
Join Date: Mar 2002
Location: Pittsburgh, PA
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There was a problem with Javascript. Not the actual JS, but the code executed an extra command that is NOT needed (This is a personal mod I did on my forum and forgot to undo changes)

Fix is attached (Tried just putting it in the reply but VB was replacing my code for some reason)

Dimitry
Reply With Quote
  #24  
Old 04-07-2004, 08:22 PM
NuclioN's Avatar
NuclioN NuclioN is offline
 
Join Date: Aug 2002
Posts: 955
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tnx for the fix, works great now.
Reply With Quote
  #25  
Old 04-15-2004, 02:00 PM
vau7 vau7 is offline
 
Join Date: Mar 2004
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Another Problem:

Sometimes i get this Error:

Quote:
Warning: getimagesize(http://www.ccc.de/campaigns/music/COPY_banner.jpg): failed to open stream: Connection refused in /home/www/web75/html/board3/includes/functions_bbcodeparse.php on line 1020
The Hack is 100% correct installed but sometimes it doesnt work and the whole Thread isnt reachable because of this error.

And if a whole Thread isnt reachable this Hack is not so good at all. Without this Error it is an absolut galant and beautiful way to solve this Problem. But can you fix this error?
That would be great!
Reply With Quote
  #26  
Old 04-15-2004, 07:52 PM
Dimitrix Dimitrix is offline
 
Join Date: Mar 2002
Location: Pittsburgh, PA
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the error I seemed to be getting a LOT lately on my server after it took about 2 mins of loading time.
The problem seems to be with that function retrieving the image at times. This is not the code's fault. It's either server's, GD library's, or PHP, I have yet to figure it out.

Ill post here as soon as I get more info on this. On my forum I had to completely disable the hack which sux because I made it
Dimitry
Reply With Quote
  #27  
Old 04-16-2004, 01:58 AM
vau7 vau7 is offline
 
Join Date: Mar 2004
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, i know that the fault isnt in the code. But there must be a way to handle it. :ermm:
Reply With Quote
  #28  
Old 04-16-2004, 12:50 PM
Dimitrix Dimitrix is offline
 
Join Date: Mar 2002
Location: Pittsburgh, PA
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I figured everything out.
Had to restart some processes on my server to get it working so it wasnt the hacks fault.

Ive added a security check that checks if the file actually exists or not. And also added a Slowdown function, which will wait 1500 miliseconds before checking each minute. This helps the previous check to be finished and server doesnt get overloaded with constant outgoing connections piled up one on one (if you have a bunch [img] in thread). This barely slows down the load of the thread, 1500 miliseconds is nothing really, but enough (or SHOULD be enough) for server to complete previous task).

I will post the upgrade and update the hack later today when I get home
Dimitry

[edit]
Here's what broken images look like Replaced with text:
http://www.designworldwide.com/forum...id=172#post172
Reply With Quote
  #29  
Old 04-16-2004, 01:56 PM
vau7 vau7 is offline
 
Join Date: Mar 2004
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dimitrix

I will post the upgrade and update the hack later today when I get home
Dimitry
THANKS!

Thats awesome!
Reply With Quote
  #30  
Old 04-16-2004, 10:08 PM
vau7 vau7 is offline
 
Join Date: Mar 2004
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something new bout the security check update?
Reply With Quote
  #31  
Old 04-17-2004, 01:16 PM
Raimund Raimund is offline
 
Join Date: Apr 2002
Location: Austria
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

to check if the file/image exists, replace the following in functions_bbcodeparse.php

Code:
// ###################### Start handle_bbcode_img_match #######################
// 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/buttons/imagebig.gif"; // <-- This is the button/image that will be displayed instead of the big image.
	$img_max_width = 640; // <-- 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);
	
	$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="" />';
}
with

Code:
// ###################### Start handle_bbcode_img_match #######################
// this is only called by handle_bbcode_img
function handle_bbcode_img_match($link)
{
	// IMPORTANT - REPLACE THE FOLLOWING 3 VARIALBS WITH YOUR INFORMATION
	$img_replacement = "images/buttons/imagebig.gif"; // <-- This is the button/image that will be displayed instead of the big image.
	$img_replacement2 = "images/buttons/imagenotexist.gif"; // <-- This is the button/image that will be displayed if file does not exist.
	$img_max_width = 640; // <-- 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);
	$image= ($link);

	if (@fclose(@fopen("$image", "r"))) { 
	$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="' .  $img_replacement2 . '" border="0" alt="" />';
 	}
}
Raimund
Reply With Quote
Reply

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. The time now is 04:13 AM.


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.04464 seconds
  • Memory Usage 2,305KB
  • 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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (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
  • (4)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