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)
-   -   Auto Resize large images in an IMG tag (https://vborg.vbsupport.ru/showthread.php?t=117674)

mr.gamesbay 06-04-2006 10:00 PM

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="" />';
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 :)

mr.gamesbay 06-05-2006 05:24 AM

< Post reserved for future use >

Tralala 06-05-2006 05:43 AM

Looks good; I am currently using this hack and get similar results. How do the two methods compare?

utw-Mephisto 06-05-2006 05:58 AM

What does it do with images smaller than the pre-configured size ?

mr.gamesbay 06-05-2006 05:59 AM

Quote:

Originally Posted by utw-Mephisto
What does it do with images smaller than the pre-configured size ?

Nothing :)

rmxs 06-05-2006 06:27 AM

resize the image after load......
I use small piece of code that resize the IMAGE ON LOAD..

Byt its cool...

utw-Mephisto 06-05-2006 07:04 AM

VERY nice ... sorry, one more question .. the size is customizeable ?

edit :

Code:

var vbimgcodeWidthMax = 500;
var vbimgcodeWidthSizeTo = 500;

never mind ;)

shadowevil 06-05-2006 08:53 AM

Mod nice *install*

Ahsin1 06-05-2006 11:03 AM

Nice hack gona install later

Rich 06-05-2006 11:43 AM

It works in IE and Opera, but I can't get it to work in FF. It is hiding the images completely.

Qwest 06-05-2006 11:51 AM

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.

mr.gamesbay 06-05-2006 11:57 AM

Quote:

Originally Posted by Rich
It works in IE and Opera, but I can't get it to work in FF. It is hiding the images completely.

I using only Firefox for browsing and i have no problem. Perhaps the problem is an Extension in Firefox.

Kihon Kata 06-05-2006 12:59 PM

Quote:

Originally Posted by Rich
It works in IE and Opera, but I can't get it to work in FF. It is hiding the images completely.

worked for my firefox

utw-Mephisto 06-05-2006 03:58 PM

Quote:

Originally Posted by Kihon Kata
worked for my firefox

Any aditional plugins installed or on default installation ? Just want to be sure it'll work for all my FF user before I install it ..

Ahsin1 06-06-2006 12:29 AM

Not working for me

PabloAM 06-06-2006 03:32 PM

For news in vbadvanced don?t resize the imgs :(

you will go for fix???

COBRAws 06-06-2006 08:28 PM

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.

KOKS@LN 06-08-2006 12:06 AM

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.

sam anders 06-08-2006 05:22 PM

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

KOKS@LN 06-10-2006 12:53 PM

open resizevbimg.js

I've changed the value as following

PHP Code:

var vbimgcodeWidthMax 680;
var 
vbimgcodeWidthSizeTo 680


sam anders 06-11-2006 11:40 AM

thanks for the info :)

tormento 06-15-2006 10:03 AM

is possible to autoresize the attachment file?

reismarktq2 06-15-2006 05:30 PM

Thanks, great hack!

/me clicks install

Spika 06-30-2006 09:10 PM

Great hack! Works fine in Firefox and Ie

DarKNull 07-04-2006 06:45 PM

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.

JimmyN 08-06-2006 09:33 AM

nice work, this is great for those to big images, iv had a heap of probelms with the skin being streached across the screen.

UZFRED 08-21-2006 05:39 PM

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 ;).

ctsolutions 08-23-2006 08:20 PM

Quote:

Originally Posted by UZFRED
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 ;).

yes, 100%.

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

kofoid 09-01-2006 10:49 PM

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?

Chriss74 09-02-2006 09:49 PM

Nice Hack!

For my purpose, I made a small, but effective change:

Code:

var vbimgcodeWidthMax = screen.width-420;
var vbimgcodeWidthSizeTo = screen.height-300;

(Depending on the individual forum layout, you should sample different values instead of 420 and 300.)

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

Elbarfo 04-17-2007 05:32 PM

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!

midnightwalker 05-18-2007 06:19 AM

didn't work on mine :(

Please check:
http://rmitportal.info/forum/showthread.php?t=4523

flup 05-18-2007 09:49 PM

Not working for me on vB3.5.4 ... too bad :(

flup 05-18-2007 10:01 PM

Got it working, FlashFXP didn't overwrite my file ;)

flup 05-19-2007 11:28 AM

Any chance to combine this with LightBoxv2 ?

flindersredclaw 08-03-2007 01:04 AM

works in 3.6.8 no probs - I am using it for vbimage host picture display and others

crakker56 02-22-2008 06:47 PM

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?

crakker56 02-26-2008 12:06 AM

anyone??

flup 12-16-2008 02:46 PM

Works like a charm, thanks

flup 12-16-2008 02:47 PM

@crakker56:

try this; in includes/class_bbcode.php replace:

Quote:

return '<img src="' . $link . '" border="0" alt="" id="vBCodeIMG" />';
with

Quote:

return '<img src="' . $link . '" border="0" alt="" id="vBCodeIMG" /><br />click image to see original size';


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
  • Page Generation 0.01346 seconds
  • Memory Usage 1,809KB
  • 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
  • (11)bbcode_code_printable
  • (1)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete