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

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
  #52  
Old 09-30-2006, 10:02 AM
PersianImmortal PersianImmortal is offline
 
Join Date: Dec 2005
Location: Australia
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, you're right, I just checked your page and it works in Firefox, but not in IE7 - the second set of pictures are not resized for some reason.

On my site however it seems to work, here is a thread from my site which has it working: http://forums.tweakguides.com/showthread.php?t=4535

Note that I edited my post on the bottom of the first page to include the same images again, and as you can see both the top set of images and bottom set of images should be working (at least they are for me in Firefox and IE7).

So maybe there's something in particular about your forums which is causing this? Any feedback from others will also be helpful.
Reply With Quote
  #53  
Old 09-30-2006, 10:17 AM
newbe_haselina newbe_haselina is offline
 
Join Date: May 2006
Location: Germany near Stuttgart
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're right, I just tested it with the Mozilla/Firefox Browser, and it works perfectly :cross-eyed:

Hmmmm, hopefully most of my users use Mozilla ... but anyway, even if it doen't work 100% with IE, it's an improvment for my community
Reply With Quote
  #54  
Old 09-30-2006, 07:14 PM
principino1984 principino1984 is offline
 
Join Date: Jul 2006
Location: Italy
Posts: 135
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found out why this hack is not working on my forum...

this is what I see with IE:



and as I click on the image... see the url:




Well, this is the problem, when this hack tries to resize the picture, it changes the url and thats why the image "disappear" on firefox..

can you help me?

thanks a lot

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

For the code I've posted on the previous page, I've tested it in Firefox 1.5.0.7 and Firefox 2 RC1, as well as Internet Explorer 7 and it doesn't seem to have any problems at all, working perfectly on my forum (see test link further above).

All I can suggest is that you follow the instructions to edit your class_bbcode.php file first, then try using the original code for the hack to see if it works, then try replacing it with my code instead and see if it works.
Reply With Quote
  #56  
Old 10-01-2006, 06:56 AM
principino1984 principino1984 is offline
 
Join Date: Jul 2006
Location: Italy
Posts: 135
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where do I find those instruction... cause the hack is workin right i think, but it still write me the url like this:

http://yurlmyforum/http://imageurl

where do I have to chage to make it ok?

Marco
Reply With Quote
  #57  
Old 10-02-2006, 06:07 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah I see. Well the screen shots help, but I really need to view the page myself (so I can view the source).

Quote:
Originally Posted by principino1984
I found out why this hack is not working on my forum...

this is what I see with IE:



and as I click on the image... see the url:




Well, this is the problem, when this hack tries to resize the picture, it changes the url and thats why the image "disappear" on firefox..

can you help me?

thanks a lot

Marco
Reply With Quote
  #58  
Old 10-02-2006, 06:35 PM
principino1984 principino1984 is offline
 
Join Date: Jul 2006
Location: Italy
Posts: 135
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i think the problem is VBSEO that rewrite all the links... right now i've just installed another hack, but If it helps you for the support for the other guy I can post you my headinclude or just tell me what do you need

Marco
Reply With Quote
  #59  
Old 10-02-2006, 06:39 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you can link me to the thread in your screen shot that should be all i need. Of course if you installed another image resize hack and uninstalled mine, I won't be able to figure out the problem Up to you, my guess is you are right, its just another hack conficting with it.

Quote:
Originally Posted by principino1984
i think the problem is VBSEO that rewrite all the links... right now i've just installed another hack, but If it helps you for the support for the other guy I can post you my headinclude or just tell me what do you need

Marco
Reply With Quote
  #60  
Old 10-12-2006, 09:53 AM
GoNz00 GoNz00 is offline
 
Join Date: Jan 2005
Posts: 158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

seems to be working fine here, the "other" image tag resizer lagged the forum to hell and back, may have been the .js file included. normal speed resumed with this one
Reply With Quote
  #61  
Old 10-12-2006, 02:57 PM
egelforum egelforum is offline
 
Join Date: Aug 2006
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone with vB 3.6.2 around? I can't get to work ANY of this image resize addons. Not even one. They just don't do anything. I think the cause is an incompatibility with 3.6.2.
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 07:26 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.11237 seconds
  • Memory Usage 2,312KB
  • 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
  • (3)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