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

Reply
 
Thread Tools
Image auto resizer Details »»
Image auto resizer
Version: 1.00, by Timmeh7 Timmeh7 is offline
Developer Last Online: Dec 2014 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 02-07-2006 Last Update: Never Installs: 31
 
No support by the author.

Hello first post \o/. I'm a long time vB lover/coder, first time poster here (having purchased my own liscence earlier... no more hanging off friend's forums for me).

Brief outline:

This mod is designed to prevent images horizontally stretching the screen, while giving you the ability to revert them to their full size if you wish.

How does this affect the user

This is a silent script - after its installation, there is no configuration or further modification required.

Lets see it then!

There are two images of the mod in action attached.

What versions will this support?

Defiantly 3.5.3 and 3.5.0 (I believe it was RC2) although it was a slightly different string you needed to search for in the php file, but it's in essentially exactly the same. I imagine that with a little messing around, it'll support earlier versions also.

Installation:

First, download the attached zip file (autoresize.zip). A copy of these instructions are also there.

Upload autoresize.js to /clientscripts/ from your forum directory.

Log into your forum admin panel, go to styles & templates > style manager > edit templates.

Edit the "SHOWTHREAD" template (Under Show Thread templates), find </head>

Just above it, add

Code:
<script type="text/javascript" src="clientscript/autoresize.js"></script>
Save it.

Repeat, adding it in the same place to the newthread template.

Now, from your forum directory, open /includes/class_bbcode.php

search for:

Code:
return '<img src="' .  $link . '" border="0" alt="" />';
Replace it with:

Code:
return '<div style= "display: none; background-color: black; color: white" onClick="catflap_toggle_image_size(this); return false">&nbsp;</div><img src="' . $link . '" onLoad="catflap_resize_image(this); return false;" border="0" />';
Give it a test, under different templates with different boundaries, it may well still stretch the table make the image a little/be a little too small.

Should this be the case, open /clientscript/autoresize.js

modify the 100 in

Code:
size_available = winwidth - 100;
either up or down (start by moving it up and down in 100's, then when it gets closer to perfect, 10's) until an image that would normally stretch the table fits completely within the forum boundaries. 100 is perfect for the default vbulletin 3.5.3 template.

Enjoy! If you have any problems, just give a shout and I'll do my best to put you right. All feedback/suggestions are also welcome.

Show Your Support

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

Comments
  #22  
Old 02-14-2006, 12:10 PM
Xzyte Xzyte is offline
 
Join Date: Nov 2005
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Same here, not working with FF 1.5.0.1
The strange thing is that the sample in his forum ( http://www.timbashford.com/forum/sho....php?p=7#post7 ) works on my FF.
Reply With Quote
  #23  
Old 02-26-2006, 07:14 PM
ubblite ubblite is offline
 
Join Date: Jan 2006
Posts: 259
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zia
Sounds nice...a java script...

does that touce sigs ? image hosted on imageshack/photobucket would be re-size too?
instead of klik ..cant it re-size the image to a pre-defined size?
I'd like to know this too. And the Firefox issue worries me a bit.
Reply With Quote
  #24  
Old 02-27-2006, 06:03 PM
wrang wrang is offline
 
Join Date: Oct 2004
Location: Sweden
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It dosent work for me at all
i run 3.5.4
Reply With Quote
  #25  
Old 03-01-2006, 11:23 AM
Kanustep Kanustep is offline
 
Join Date: Jul 2005
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't work here too...Using 3.5.4
Reply With Quote
  #26  
Old 03-04-2006, 07:23 PM
Mr Chad's Avatar
Mr Chad Mr Chad is offline
 
Join Date: Jul 2005
Posts: 911
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Kanustep
Don't work here too...Using 3.5.4
it works in 3.5.4 in IE, not FF tho.
Reply With Quote
  #27  
Old 03-05-2006, 08:57 PM
cloyal cloyal is offline
 
Join Date: Sep 2005
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by chatbum
it works in 3.5.4 in IE, not FF tho.

This is the same thing I have, works in 3.5.4 just not FF, IE works great.


Is there a way to address this for FF?
Reply With Quote
  #28  
Old 03-08-2006, 02:39 PM
aladinliverpool aladinliverpool is offline
 
Join Date: Aug 2004
Location: Liverpool UK
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cloyal
This is the same thing I have, works in 3.5.4 just not FF, IE works great.


Is there a way to address this for FF?
ive just installed this as well. maybe ill start reading what happens to users first.
Reply With Quote
  #29  
Old 03-18-2006, 11:30 AM
himring himring is offline
 
Join Date: Feb 2005
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, I modified the script this way, thanks to stcont, and it work perfectly in Firefox and Opera.

Code:
 
function catflap_resize_image (imageref)
  {
    var winwidth = 0;
    var size_available = 700; //to set 700pixel as your max image size
    if (self.innerWidth) winwidth = self.innerWidth;
      else if (document.documentElement && document.documentElement.clientWidth) winwidth = document.documentElement.clientWidth;
        else if (document.body) winwidth = document.body.clientWidth;
    //size_available = winwidth - 600;
    if (imageref.width > size_available)
      {
        var pc = Math.round (size_available / imageref.width * 10000) / 100;
        imageref.catflap_original_width=imageref.width;
        imageref.catflap_shrunk_width=size_available;
        imageref.catflap_shrunk_pc=pc;
        imageref.catflap_shrunk_status=1;
        imageref.style.width=size_available+'px';
        if (imageref.previousSibling)
          {
            imageref.previousSibling.style.width=size_available+'px';
            imageref.previousSibling.firstChild.nodeValue="Immagine ridimensionata al " + pc + "% delle sue dimensioni. Clicca qui per vederla nelle dimensioni originali.";
            imageref.previousSibling.style.display = 'block';
          }
      }
  }
function catflap_toggle_image_size (imageref)
  {
    if (imageref.nextSibling)
      {
        if (imageref.nextSibling.catflap_shrunk_status == 1)
          {
            imageref.firstChild.nodeValue="Immagine a dimensioni originali. Clicca qui per rimpicciolirla.";
            imageref.style.width=imageref.nextSibling.catflap_original_width+'px';
            imageref.nextSibling.style.width=imageref.nextSibling.catflap_original_width+'px';
            imageref.nextSibling.catflap_shrunk_status=0;
            imageref.style.display = 'block';
          }
         else
          {
            imageref.firstChild.nodeValue="Immagine ridimensionata al " + imageref.nextSibling.catflap_shrunk_pc + "% delle sue dimensioni. Clicca qui per vederla nelle dimensioni originali.";
            imageref.style.width=imageref.nextSibling.catflap_shrunk_width+'px';
            imageref.nextSibling.style.width=imageref.nextSibling.catflap_shrunk_width+'px';
            imageref.nextSibling.catflap_shrunk_status=1;
            imageref.style.display = 'block';
          }
      }
  }
Now I have another problem, if I load a thread with large image under IE, the first time tha script work nice, but if I reload the page it doesn't anymore. For example io con go here:

http://www.sapphireitaly.com/forum/showthread.php?t=13

the image should load resized, try now to hit the reload button (F5) and as you can see the image are not resized any more, and from now on they never been resized any more.

Any suggestion.

P.S.: Sorry of my english :cry:
Reply With Quote
  #30  
Old 03-30-2006, 09:18 PM
KeeperPL KeeperPL is offline
 
Join Date: Jun 2003
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by himring
Now I have another problem, if I load a thread with large image under IE, the first time tha script work nice, but if I reload the page it doesn't anymore. For example io con go here:

http://www.sapphireitaly.com/forum/showthread.php?t=13

the image should load resized, try now to hit the reload button (F5) and as you can see the image are not resized any more, and from now on they never been resized any more.
I have the same problem
Reply With Quote
  #31  
Old 04-26-2006, 04:05 AM
robert_2004 robert_2004 is offline
 
Join Date: Sep 2004
Posts: 126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

adding the <script> to the SHOWTHREAD template didn't work for me. i ended up adding it to the heardinclude template instead.
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 10:53 PM.


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.06415 seconds
  • Memory Usage 2,316KB
  • 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
  • (5)bbcode_code
  • (5)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
  • (3)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