View Full Version : Dynamcially Resize Images
cheechm
01-23-2008, 10:07 PM
Hi,
Is there a JavaScript code that resizes images automatically when the page loads? (I can't use CSS because the image is loaded directly from IPB so there is no class etc)
(I know there is a mod for vBulletin which makes every image a thumbnail with the possibility to open it full size)
Thanks
Wait so what do you want really?
Like a small image that gets bigger when you click a button or something?
djr33
01-23-2008, 11:43 PM
You can use the html properties of width and/or height (preferably width), those properties with css (either through a class or the style="" attribute), or you can use Javascript like you're doing. That's really all that can be done.
If you want to deal with some more complex code and it seems needed (note also that this is a load on the server and may take a few moments to process, every time it loads), you can use the PHP GD image manipulation library, specifically open an image, resize using imagecopyresampled(), then output that image. Information is availble here:
http://www.php.net/manual/en/ref.image.php
Or, of course, you could just save the images to the proper size in the first place, even if that places two copies on your server-- that's probably easiest.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.