vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Forum Display Enhancements - Resize large [IMG] images and link them to original (https://vborg.vbsupport.ru/showthread.php?t=127577)

nsanden 09-25-2006 10:00 PM

Resize large [IMG] images and link them to original
 
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>


Comalies 09-26-2006 12:22 AM

Demo/screenshot please.

teedizz 09-26-2006 12:42 AM

will this also resize sigs in the [IMG] tags? if so can you prevent that. thanks.

COBRAws 09-26-2006 01:56 AM

Quote:

Originally Posted by Comalies
Demo/screenshot please.

here:
Quote:

his mod should resize [IMG] images and link them to their original size.

nsanden 09-26-2006 02:45 AM

You can demo it on http://www.timesharetrap.com/forums/...tyleid=1#post7

nsanden 09-26-2006 02:52 AM

Quote:

Originally Posted by teedizz
will this also resize sigs in the [IMG] tags? if so can you prevent that. thanks.

I believe it would. Why wouldn't you want that though?

teedizz 09-26-2006 03:04 AM

because some of my members use sigs like 650x650 & it still resizes those. I just want it for pictures in threads.

teedizz 09-26-2006 03:06 AM

the other img hack wouldnt do that. I like this one alot better so hopefully you can add that as an option ;)

nsanden 09-26-2006 03:45 AM

Updated, so the images are hidden until the browser actually resizes them. (This way you don't see the page loading with big images and then all of a sudden shrink to the right size.)

nsanden 09-26-2006 03:46 AM

Sorry teedizz i don't think i'm going to add that change. Doesn't make sense to me. No reason to resize images in the post if you aren't going to resize images in the signature as well. Whole point is to NOT break your design.


All times are GMT. The time now is 12:35 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01257 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete