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

Reply
 
Thread Tools
Resize large [IMG] images and link them to original Details »»
Resize large [IMG] images and link them to original
Version: 1.01, by nsanden nsanden is offline
Developer Last Online: Aug 2013 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.6.1 Rating:
Released: 09-25-2006 Last Update: Never Installs: 39
Template Edits
Code Changes Is in Beta Stage  
No support by the author.

This mod should resize [IMG] images wider than 'max_width' and link them to their original size. Not very well tested, i'm hoping for some feedback/suggestions. I have tested in firefox/IE latest versions and it seems to work fine. Should be a pretty quick install.

INSTALL:

1) Edit /includes/class_bbcode.php around line 1879 for me.

Look for:
Code:
return '<img src="' . $link . '" border="0" alt="" />';
Change to:
Code:
return '<img src="' . $link . '" border="0" alt="" class="img_tag" />';
2) Add the following to the headinclude template.

Code:
<if condition="THIS_SCRIPT == 'showthread'">

<script type="text/javascript">

max_width = 700;

if(document.documentElement.outerHTML == null) {
   HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
   var r = this.ownerDocument.createRange();
   r.setStartBefore(this);
   var df = r.createContextualFragment(sHTML);
   this.parentNode.replaceChild(df, this);
});
}

function resizeImages() {
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i];
      if(img.className == "img_tag") {
         if(img.width > max_width) {
            var strNewHTML = '<a href="' + img.src + '" target="_blank"><img width = "' + max_width + '" src="' + img.src + '" border=0 alt="" /></a>';
            img.outerHTML = strNewHTML;
         }
      }
   }
}

if (window.addEventListener) {
  window.addEventListener('load', resizeImages, false);
} else if (window.attachEvent) {
  window.attachEvent('onload', resizeImages);
} else {
  window.onload = resizeImages;
} 

</script>

</if>

Show Your Support

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

Comments
  #72  
Old 10-13-2006, 11:26 PM
BarelyHangingOn BarelyHangingOn is offline
 
Join Date: Feb 2003
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works with 3.5.4
Reply With Quote
  #73  
Old 10-14-2006, 10:59 AM
PersianImmortal PersianImmortal is offline
 
Join Date: Dec 2005
Location: Australia
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When testing your forum changes on your browser also make sure to press CTRL+F5 to force refresh the changes, just in case your browser is using cached versions of files.
Reply With Quote
  #74  
Old 11-07-2006, 10:16 PM
Viper007Bond's Avatar
Viper007Bond Viper007Bond is offline
 
Join Date: Oct 2006
Location: Portland, OR, USA
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FYI: Having multiple items with the same ID breaks XHTML validness. A CSS class should be used instead.
Reply With Quote
  #75  
Old 11-08-2006, 02:07 AM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Viper007Bond
FYI: Having multiple items with the same ID breaks XHTML validness. A CSS class should be used instead.
Yep, good point. Fixed!
Reply With Quote
  #76  
Old 11-14-2006, 09:10 PM
Codeman05 Codeman05 is offline
 
Join Date: Oct 2002
Location: Tx
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just installed it on my VB3.6.3 install and its not working either.

The images appear initially, and then disappear (once the script runs).

Any suggestions?
Reply With Quote
  #77  
Old 11-15-2006, 05:44 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Codeman05 View Post
I just installed it on my VB3.6.3 install and its not working either.

The images appear initially, and then disappear (once the script runs).

Any suggestions?
Browser? OS? Are you installing the original code in the first post or the version someone else posted later?
Reply With Quote
  #78  
Old 11-15-2006, 05:52 PM
Codeman05 Codeman05 is offline
 
Join Date: Oct 2002
Location: Tx
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nsanden View Post
Browser? OS? Are you installing the original code in the first post or the version someone else posted later?
any browser, any o/s, original code.

I've switched to another script, so no worries. Thanks
Reply With Quote
  #79  
Old 04-23-2007, 05:18 AM
harlita harlita is offline
 
Join Date: Dec 2006
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just installed on 3.6.5

Works like a charm <3

Thanks much!! EXACTLY what I was looking for. YOSH!
Reply With Quote
  #80  
Old 04-30-2008, 07:31 AM
srikanthbr srikanthbr is offline
 
Join Date: Apr 2008
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this dosent work?
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 07:46 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.06206 seconds
  • Memory Usage 2,287KB
  • Queries Executed 24 (?)
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
  • (3)bbcode_code
  • (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
  • (2)pagenav_pagelink
  • (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