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
Auto Resize large images in an IMG tag Details »»
Auto Resize large images in an IMG tag
Version: 1.00, by mr.gamesbay mr.gamesbay is offline
Developer Last Online: Dec 2009 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.6.4 Rating:
Released: 08-31-2006 Last Update: Never Installs: 272
Template Edits
Code Changes Additional Files  
No support by the author.

First, sorry about my bad english

With this small hack, all large images in an IMG Tag will be resized after the site has loaded. With a click on the resized imge, it will open in an new window with the original size. Works in Firefox, Opera, IE and i think in all other browser.
Here is a Demo: Link

Work with vB 3.6.0 - 3.6.4

INSTALLATION:

--------------------------------

- Copy the file resizevbimg.js in the dir clientscript.

--------------------------------

Open the file includes/class_bbcode.php
Search the line(~line 1887 ):

Code:
return '<img src="' .  $link . '" border="0" alt="" />';
and replace with:
Code:
return '<img src="' .  $link . '" border="0" alt="" id="vBCodeIMG" />';
Save and upload.

--------------------------------

Styles & Templates > Search the SHOWTHREAD Template
Seach:
Code:
<body onload="$onload">
Replace with:
Code:
<body onload="$onload;vbImageResize()">
Save the template.

--------------------------------

Styles & Templates > Search the NEWREPLY Template
Search:
Code:
 <body$onload>
Replace with:
Code:
<body onload="$onload;vbImageResize()">
Save the template.

--------------------------------

- Styles & Templates > Style Manager > Common Templates > headinclude
Search:
Code:
<!-- / CSS Stylesheet -->
After, add:
Code:
<script type="text/javascript" src="clientscript/resizevbimg.js"></script>
Save the template.

--------------------------------

Styles & Templates > Style Manager > Main CSS > Additional CSS Definitions

After, add:
Code:
.vbimgcodelimit {
        cursor: pointer;
        border: dotted 1px black;
}
Save.
--------------------------------

Done

Show Your Support

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

Comments
  #102  
Old 04-25-2007, 12:08 PM
cunder's Avatar
cunder cunder is offline
 
Join Date: May 2005
Location: NL
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello

Thank you man nice mod

But I use these mod vS-Hide.Hack.Resurrection.Expanded_2.8.1_by.Psionic.V ision

When someone presses on my site on the thanked button the pics reresize my images!

is there a way of changing wen someone press the thanks button en te pics don't stay resize !!!

thanks
Reply With Quote
  #103  
Old 04-27-2007, 04:06 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can I edit the PHP file with just notepad, or do I need something specific for these file types?

Thank you...

Regards,
Badger

Edit: NM, I downloaded a freeware PHP editor just in case, which seemed to work fine...
Reply With Quote
  #104  
Old 04-27-2007, 04:52 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by g0rdy View Post
Works with vBadvanced too:

mod the adv_portal template

find
Code:
<body>
replace
Code:
<body onload="$onload;vbImageResize()">
such an important mod never understood why it is never included on any bb software
I have VBadvanced installed, but I didn't need to do this to make it work in v3.6.4? I just followed the author's instructions and it works fine, except of course, after displaying an edited post. The original large pic shows up there until you "submit" the edit and refresh the screen.

Should I be modding the "adv_portal template" as well, even though it seems to be working?

Nice mod and something like this should be included in original version.

Thanks

Regards,
Badger
Reply With Quote
  #105  
Old 04-30-2007, 12:07 PM
wengi's Avatar
wengi wengi is offline
 
Join Date: Aug 2006
Location: Malta
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and working gr8 on 3.6.5

Regards
Wengi
Reply With Quote
  #106  
Old 05-04-2007, 12:54 AM
kildjean kildjean is offline
 
Join Date: Jun 2005
Location: Bowie, Md
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a suggestion, which I think it would be great...

You know when you click on the image that it pops up in a different window? You should make an addon to the script so it uses the Lightbox.js script to pop that image instead than a different window.

I'd love to see this implemented because it would make this script yet much cooler...

What do you think?

Kil

PS. I have this installed in 3.6.5 and it works just fine.
Reply With Quote
  #107  
Old 05-10-2007, 03:16 PM
Lemac Lemac is offline
 
Join Date: Jan 2002
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very Good!
Reply With Quote
  #108  
Old 05-11-2007, 12:54 PM
ashraf_gawdat ashraf_gawdat is offline
 
Join Date: May 2005
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by janslu View Post
mr.gamesbay,
you've made a terrific job. I am importing a large forum from smf to VB and I got tons of extremely large files that ruin my fluid xhtml page. Your hack saves me

There's just one thing that I think should be changed. It is illegal to declare more than one object with the same id on the same page. I think you should've used class for declaration:

1. for includes/class_bbcode.php:
Code:
return '<img src="' .  $link . '" border="0" alt="" class="vBCodeIMG" />';
2. and one change in line #11 of resizevbimg.js:
Code:
if (docImg[i].width > vbimgcodeWidthMax && docImg.className == 'vBCodeIMG') {
What do you think?
I agree with this as it is not standard to have multiple id's in the same document. To install this hack with standards taken into consideration you may make the changes janslu mentioned above, but you must another 2 changes:

1. In line #13 of resizevbimg.js find
Code:
[i]docImg.className = vbimgcodeClassName;
and remove it completely. Or you can just comment it by adding // (double slash) before the mentioned line.

[i]2. In Styles & Templates > Style Manager > Main CSS > Additional CSS Definitions
instead of adding
Code:
.vbimgcodelimit {
        cursor: pointer;
        border: dotted 1px black;
}
add
Code:
.vBCodeIMG {
        cursor: pointer;
        border: dotted 1px black;
}
And that's it.

Any way it is a good hack and I installed it.
Reply With Quote
  #109  
Old 05-11-2007, 02:04 PM
ashraf_gawdat ashraf_gawdat is offline
 
Join Date: May 2005
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To make modifications in less templates, Additional CSS Definitions template may not be modified at all. Instead, the same effect can be made using javascript.

In file resizevbimg.js:

find
Code:
docImg[i].onclick = vbImagecodeWinOpen;
After it add:
Code:
docImg[i].style.cursor = 'pointer';
docImg[i].style.cursor = 'hand';
docImg[i].style.border = 'dotted 1px black';
The same effect of editing the CSS in Additional CSS Definitions template will be done.

Using 2 cursor values (pointer & hand) instead of (pointer) only to be cross browser, as (pointer) value is valid only for NS6/ IE6.
Reply With Quote
  #110  
Old 05-20-2007, 09:04 AM
Samy Samy is offline
 
Join Date: Apr 2005
Location: Spain
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In a version 3.6.7 the line modified in a file class_bbcode.php is: ~ line1937
Reply With Quote
  #111  
Old 05-31-2007, 03:24 AM
cvn cvn is offline
 
Join Date: May 2006
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works on 3.6.7
Not work with Safari.

Thank you very much for your nice hack!

Click Installed now.
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 09:27 PM.


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.05350 seconds
  • Memory Usage 2,325KB
  • 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
  • (18)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