![]() |
Auto Resize large images in an IMG tag
First, sorry about my bad english :rolleyes:
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 INSTALLATION: -------------------------------- - Copy the file resizevbimg.js in the dir clientscript. -------------------------------- Open the file includes/class_bbcode.php Search the line(~line 1831): Code:
return '<img src="' . $link . '" border="0" alt="" />'; Code:
return '<img src="' . $link . '" border="0" alt="" id="vBCodeIMG" />'; -------------------------------- Styles & Templates > Search the SHOWTHREAD Template Seach: Code:
<body onload="$onload"> Code:
<body onload="$onload;vbImageResize()"> -------------------------------- Styles & Templates > Search the NEWREPLY Template Search: Code:
<body$onload> Code:
<body onload="$onload;vbImageResize()"> -------------------------------- - Styles & Templates > Style Manager > Common Templates > headinclude Search: Code:
<!-- / CSS Stylesheet --> Code:
<script type="text/javascript" src="clientscript/resizevbimg.js"></script> -------------------------------- Styles & Templates > Style Manager > Main CSS > Additional CSS Definitions After, add: Code:
.vbimgcodelimit { -------------------------------- Done :) |
< Post reserved for future use >
|
Looks good; I am currently using this hack and get similar results. How do the two methods compare?
|
What does it do with images smaller than the pre-configured size ?
|
Quote:
|
resize the image after load......
I use small piece of code that resize the IMAGE ON LOAD.. Byt its cool... |
VERY nice ... sorry, one more question .. the size is customizeable ?
edit : Code:
var vbimgcodeWidthMax = 500; |
Mod nice *install*
|
Nice hack gona install later
|
It works in IE and Opera, but I can't get it to work in FF. It is hiding the images completely.
|
That's the problem with using JS for stuff.
That's why I always like to do things server side to mitigate any browser compatibility issues. |
Quote:
|
Quote:
|
Quote:
|
Not working for me
|
For news in vbadvanced don?t resize the imgs :(
you will go for fix??? |
Dunno whats the diff between the existing hacks for image resize, so I wont bother installing.
Perhaps, if you stated the diff I would install. Thank you. |
I'm very grateful to you. Thanks a lot.
At last I could find a working mod. I've tried most of the other mods which is intented to auto resize oversized images. They may work for some others. And thanks to them as well. But this mod worked both on IE and Firefox 1.5.0.4 on a vB 3.5.4 forum. BTW I've customised resizevbimg.js for 680px and translated the phrase into Turkish. No problem with doing that ;) Thansk again. I had been really bored with big images in posts and signatures which spoil the view. |
does any one know which file i edit to change the resize values?
i see some one else mentiond the lines of the code but i can seem to find the file that contains the coding |
open resizevbimg.js
I've changed the value as following PHP Code:
|
thanks for the info :)
|
is possible to autoresize the attachment file?
|
Thanks, great hack!
/me clicks install |
Great hack! Works fine in Firefox and Ie
|
oh man..i installed it and it messed up my board..i reversed everything but still can't get my forum back to normal. the threads just doesn't load anymore ;(
The following error occurred when attempting to evaluate this template: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/crickets/public_html/desihotty/includes/adminfunctions_template.php(3537) : eval()'d code on line 324 This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish. |
nice work, this is great for those to big images, iv had a heap of probelms with the skin being streached across the screen.
|
Does this work for 3.6.0? If so could you please update the thread and change it to 3.6.0? Great hack, been loving it since I installed it ;).
|
Quote:
tested with IE,Opera 9.1, FF. I have installed on my vbulletin 3.6 and working like a charm. Many thanks mr.gamesbay you can push your hack to 3.6 mike |
works great! One question - when it resizes a picture, it ends up stretching my header/logo to a gigantic size... Should I put the css code at the beginning of the additional info area?
|
Nice Hack!
For my purpose, I made a small, but effective change: Code:
var vbimgcodeWidthMax = screen.width-420; Now the max image-size depends on the screen-resolution of the visitor. Do the visitor have a high screen-resolution, he will see a greater pic than a visitor, that have a lower screen-resolution. In any case, the screen resolution will be used to its full capacity, without the problem, that the forum-layout gets destroyed, because of oversized pics. Greetings, Chriss |
Was looking for a cleaner solution for 3.6.5 and this worked perfectly!
I can't believe this isn't supported. It's certianly a lot cleaner solution that many others I've seen. Easy breezy! Tested in FF, and IE6 &7 Thanks! |
|
Not working for me on vB3.5.4 ... too bad :(
|
Got it working, FlashFXP didn't overwrite my file ;)
|
Any chance to combine this with LightBoxv2 ?
|
works in 3.6.8 no probs - I am using it for vbimage host picture display and others
|
I know there is a way, but I don't know how to do it.
How can I add a line that says "Click image to see original size" ?? EDIT - I see it says that in the resizevbimg.js file but it does not show up on my site. Any clue? |
anyone??
|
Works like a charm, thanks
|
@crakker56:
try this; in includes/class_bbcode.php replace: Quote:
Quote:
|
All times are GMT. The time now is 04:34 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|