vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Image auto resizer (https://vborg.vbsupport.ru/showthread.php?t=107430)

Timmeh7 02-07-2006 10:00 PM

Image auto resizer
 
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.

ThePimp 02-08-2006 01:40 AM

Wrong forum. This is a "Code Modification".

PcFreak 02-08-2006 02:23 AM

For me, the forum is the right ones.

Thank you for sharing your js script. :pirate:

PcFreak

apfparadise 02-08-2006 04:26 AM

Interesting, how about a link to a working version. I can't figure it out from the screenies. Does it open it in a new window as a full, or resizes it in the same window. What's the default state, resized or original? Does it work cross-browser? IE, Opera, and Firefox?

hiiped 02-08-2006 04:36 AM

Quote:

Originally Posted by apfparadise
Interesting, how about a link to a working version. I can't figure it out from the screenies. ...........Does it open it in a new window ... NO


http://www.timbashford.com/forum/sho....php?p=7#post7

Timmeh7 02-08-2006 07:00 AM

Quote:

Originally Posted by apfparadise
Interesting, how about a link to a working version. I can't figure it out from the screenies. Does it open it in a new window as a full, or resizes it in the same window. What's the default state, resized or original? Does it work cross-browser? IE, Opera, and Firefox?

It resizes in the same window (and stretches the table as it goes), the default state is resized - though if you didn't like this, it'd be very easy to swap around, it works in all browsers I've tested including IE, Firefox, Opera, Mozilla etc.

Link is up there :)

c0d3x 02-08-2006 09:16 AM

unfortunately it doesn't works for me, i run vb 3.5.3, the bar says it reduced the image, but the image has still its original dimensions

3dsoft 02-08-2006 09:27 AM

the pics (bbcode) don't resize. And it does not show "Click this bar..."
I have got the default layout template 3.5.3 installed.

Edit: works great - I accidently put the code before <head> instead of </head>

stcont 02-08-2006 10:19 AM

Firefox 1.5.0.1 does not resize image. Note that if u whant use "style.width" u must specify width accoding to spec with dimensions eg not
Code:

imageref.previousSibling.style.width=size_available;
but
Code:

imageref.previousSibling.style.width=size_available+'px';
Thats fixes problem in FF

c0d3x 02-08-2006 10:31 AM

width of the table or of the img??


All times are GMT. The time now is 07:30 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.01229 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
  • (6)bbcode_code_printable
  • (2)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