Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Auto Resize Your Images 3.52 compliant Details »»
Auto Resize Your Images 3.52 compliant
Version: 1.00, by ggiersdorf ggiersdorf is offline
Developer Last Online: Aug 2012 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 12-27-2005 Last Update: Never Installs: 100
Template Edits
Code Changes  
No support by the author.

I was looking for some code that would allow an image over size x to be resized in IE, Firefox, and Opera. I tried all the variations out there without luck some would work in IE, some in Firefox, etc.. So I finally got a tweaked version of some old code that actually works flawless in IE, Firefox, and Opera. I have included it below, but It needs 1 final tweak that I'm hoping someone in the community can help with.

i am NOT taking credit for this hack, all I have done is tweak it to get it working for me..


This code has been updated as of 8:30pm with the clickable link built in now!

Step 1: Edit your class_bbcode.php file located in (root/includes)

find

PHP Code:
return '<img src="' .  $link '" border="0" alt="" />'
replace with the following.

PHP Code:
/* Start Image RESIZE */  

 
$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower$_SERVER['HTTP_USER_AGENT'] ) : '';   
if (
stristr($navigator_user_agent"msie")) {   
    return 
'<a href="' .  $link '" target="_blank"><img src="' .  $link '" border="0" alt="" style="width: expression(this.width > 640 ? 480 : true);" /></a>';   
} else {   
    return 
'<a href="' .  $link '" target="_blank"><img src="' .  $link '" border="0" alt="" style="max-width: 730px;" /></a>';   
}    

/* End Image RESIZE */ 
you can play with the widths to get what you want working.

Show Your Support

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

Comments
  #72  
Old 01-23-2006, 01:45 PM
Puntoboy Puntoboy is offline
 
Join Date: Sep 2005
Location: Northampton UK
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok mine is exactly like that, so i need to change both to 600 or just the 640 ? 480?
Reply With Quote
  #73  
Old 01-23-2006, 01:48 PM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Both is OK.
Than it will resize if the picture is bigger than 600 and will resize it to 600.

But now I realize that the original hack by ggiegsdorf will always put a link on a picture.
My version in post #52 doesn't do that, but it's performance is less quick in threads with a lot of pics.
Reply With Quote
  #74  
Old 01-23-2006, 02:53 PM
Puntoboy Puntoboy is offline
 
Join Date: Sep 2005
Location: Northampton UK
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so if i use your code i won't have a problem?

Code:
	 /* Start hack Image RESIZE */  

		// Check to see if image exists
 		$link = str_replace(" " , "%20", $link);
 		$link = str_replace("&amp;" , "%26", $link);

		// Get host url name for fsockopen to see if server is reachable
		$img_host=str_replace('http://','',$link);
		$img_host=substr($img_host,0,strpos($img_host,'/'));

		// Check is server is reachable and timeout in 5 seconds if not
		if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
			// Check if image is on server
			if (@fclose(@fopen("$link", "rb"))) { 
				// Check image size and if oversize, change bbtag
				$img_width = getimagesize($link);
				if ($img_width[0] > 600) {
	 				$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';   
					if (stristr($navigator_user_agent, "msie")) {   
    					return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="width: expression(this.width > 600 ? 600 : true);" /></a>';   
					} else {   
    					return '<a href="' .  $link . '" target="_blank"><img src="' .  $link . '" border="0" alt="' . $vbphrase['click_for_larger_image'] . '" style="max-width: 600px;" /></a>';   
					}
				} else {
					return '<img src="' .  $link . '" border="0" alt="" />';
				}
			} else {
				// Image not found
				return '<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">' . $vbphrase['image_link_broken'] . '</font></td></tr></table>';
			}
		} else {
			// Server is down
			return '<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">' . $vbphrase['image_server_down'] . '</font></td></tr></table>';
		}
		
	/* End hack Image RESIZE */
Reply With Quote
  #75  
Old 01-23-2006, 06:04 PM
vietfancy's Avatar
vietfancy vietfancy is offline
 
Join Date: Feb 2005
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, installed
Reply With Quote
  #76  
Old 01-23-2006, 08:13 PM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Puntoboy, yes technicaly it works. It may slow down some pages with many pictures on it, but it doesn't touch images smaller than the width variable you use in the code.
Try it, and if you don't like it, than just get rid of it
Reply With Quote
  #77  
Old 01-24-2006, 05:20 AM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HR3rdGen
Heres the problem with this, it turns every [img] tag into a resize and link.

so now signature images are clickable. BOO
helo...me too get the same probs (error)
after that I pm to the main coder...


i got a reply that,,hes bizi with another hack....

i gez..he should have informed about this,,,taht lots of us are facing this problem..


we want it will re-size (thumbnail) every image hosted on imageshack or photobucket ...but it should ignore sigs image..

i think u can imform him abut ur probs....

Thankx Friendz
Reply With Quote
  #78  
Old 01-24-2006, 03:19 PM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, this isn't or ever was supported.
It's just a piece of code he has shared with us
I guess that if you don't like it, you just uninstall.

The code in post #52 doesn't touch the sigs, but it has a performance problem. Because I don't know how to fix that I won't release it as a hack either

Just take the original code or my version if you like it. If not, don't use it.
Maybe someone will come along that can sort the problems out and will release it as a working hack that doesn't get replies like "BOO".
Reply With Quote
  #79  
Old 01-26-2006, 12:47 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been reading this thread and working on a few things myself here. I have finally gotten the code to work 99.9% of the time in IE and Firefox I dont have nor want Opera so I have not tested this new code on it. The image are clickable but I'm working on one last thing which should make everyone here pretty happy.

(anyone who know the exact location of where signatures are displayed in the code of vbulletin please PM me I have a hack for hopefully fixing this issue also)

Hopefully once I work out this issue it will be ready to upload to you.. Code and Hack required.
Reply With Quote
  #80  
Old 01-26-2006, 05:02 PM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ggiersdorf
I have been reading this thread and working on a few things myself here. I have finally gotten the code to work 99.9% of the time in IE and Firefox I dont have nor want Opera so I have not tested this new code on it. The image are clickable but I'm working on one last thing which should make everyone here pretty happy.

(anyone who know the exact location of where signatures are displayed in the code of vbulletin please PM me I have a hack for hopefully fixing this issue also)

Hopefully once I work out this issue it will be ready to upload to you.. Code and Hack required.
ouch...i cant say it.......
any one know it ?

really a lots people will be benifited with this..
Reply With Quote
  #81  
Old 01-26-2006, 05:48 PM
Stangsta's Avatar
Stangsta Stangsta is offline
 
Join Date: Aug 2004
Location: Virginia
Posts: 440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ggiersdorf
I have been reading this thread and working on a few things myself here. I have finally gotten the code to work 99.9% of the time in IE and Firefox I dont have nor want Opera so I have not tested this new code on it. The image are clickable but I'm working on one last thing which should make everyone here pretty happy.

(anyone who know the exact location of where signatures are displayed in the code of vbulletin please PM me I have a hack for hopefully fixing this issue also)

Hopefully once I work out this issue it will be ready to upload to you.. Code and Hack required.
Postbit and postbit legacy template.


PHP Code:
<!-- sig -->
            <
div>
                
__________________<br />
                
$post[signature]
            </
div>
        <!-- / 
sig --> 
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 11:14 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.05088 seconds
  • Memory Usage 2,318KB
  • 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
  • (1)bbcode_code
  • (3)bbcode_php
  • (3)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