Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

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
  #2  
Old 12-28-2005, 10:41 PM
BluPhoenix BluPhoenix is offline
 
Join Date: Nov 2004
Location: Wirral Peninsula
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

change:
Code:
/* Start Image RESIZE */  

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

/* End Image RESIZE */
to:

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 */
That'll make it clickable.. but what does the javascript addition do? from what I see your just using css no need for the javascript?
Reply With Quote
  #3  
Old 12-28-2005, 11:18 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually you do not need the Java, it was a left over routine from an older version.
Thank you for you addition to this hack.. I truley believe this is the best auto-resize for vbulletin 3.5+

Now we need to add a Click here to enlarge text over the image!

I have tested and modified the code at the top.. any additions or modifications to make this better please let us know!

Otherwise enjoy!

Example is at http://www.gamereports.net/showthread.php?p=167#post167
Reply With Quote
  #4  
Old 12-29-2005, 12:16 AM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not resizing in Opera. IE looks great.
Reply With Quote
  #5  
Old 12-29-2005, 03:15 AM
joelabq joelabq is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's a modified version with "Click to enlarge image" text on top/bottom...Just a quick edit...

PHP Code:
/* Start Image RESIZE */  

         
$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower$_SERVER['HTTP_USER_AGENT'] ) : ''
           
        if (
stristr($navigator_user_agent"msie")) {
            
$image_size_link '
            <img src="' 
.  $link '" border="0" alt="" style="width: expression(this.width > 640 ? 480 : true);" />';   
                } 
                else {   
            
$image_size_link '<img src="' .  $link '" border="0" alt="" style="max-width: 730px;" />';
        }
            
$image_size '
                
                <table cellpadding="0" cellspacing="0" border="1">
                    <tr><td style="background-color:#000000;color:#FFFFFF;">
                <a href="' 
.  $link '" target="_blank" style="color:#FFFFFF;text-decoration:none;">Click to enlarge image</a>
                    </td></tr>
                    <tr><td><a href="' 
.  $link '" target="_blank">' $image_size_link '</a></td></tr>
                    <tr><td style="background-color:#000000;color:#FFFFFF;">
                <a href="' 
.  $link '" target="_blank" style="color:#FFFFFF;text-decoration:none;">Click to enlarge image</a>
                    </td></tr>
                </table>
                
            '
;   
        return 
$image_size;    

/* End Image RESIZE */ 
Reply With Quote
  #6  
Old 12-29-2005, 04:15 AM
apfparadise apfparadise is offline
 
Join Date: Jan 2005
Location: Northridge CA
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is weird, but my /includes/class_bbcode.php does not have this line at all, or even parts of it in any shape or form:

Code:
 return '<img src="' .  $link . '" border="0" alt="" />';
Reply With Quote
  #7  
Old 12-29-2005, 04:26 AM
Aaron RV's Avatar
Aaron RV Aaron RV is offline
 
Join Date: Mar 2002
Location: Italy
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Work but if I quote a message with the image the writing it appears "click to..." repeated.
Reply With Quote
  #8  
Old 12-29-2005, 05:38 AM
joelabq joelabq is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by apfparadise
This is weird, but my /includes/class_bbcode.php does not have this line at all, or even parts of it in any shape or form:

Code:
 return '<img src="' .  $link . '" border="0" alt="" />';
I had to take out some of the leading and trailing text to find it for some reason myself...

Try searching with the return ' part

I didn't try that quoting thing... I'm gonna go check that now.

Joel
Reply With Quote
  #9  
Old 12-29-2005, 06:03 AM
furst furst is offline
 
Join Date: Dec 2005
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This looks pretty good and I'll most likely install it tomorrow.

..mind if I ask where you got a working link hider for 3.5.2?

Quote:
[Link only for Registered Users. Please sign up and help us grow!]
Reply With Quote
  #10  
Old 12-29-2005, 08:05 AM
sensimilla sensimilla is offline
 
Join Date: Dec 2004
Location: Poland
Posts: 555
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats the best one from all I tried before! thanks
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:53 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.05026 seconds
  • Memory Usage 2,313KB
  • Queries Executed 23 (?)
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
  • (4)bbcode_code
  • (3)bbcode_php
  • (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
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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