View Full Version : Image Resizing
09-12-2008, 04:41 AM
I would like to resize images, but I do not want to save them resized, I would prefer changing the size by using the <img src='' height='%' width='%' />. I have an image uploader that displays the user's uploaded images, and I don;t want a 500x500 image in a 900 pixel wide space with 2 other images sharing the row.
Is there an easy way to do this?
09-12-2008, 05:08 AM
09-12-2008, 05:23 AM
Google Ajax Image Resize.
09-12-2008, 11:09 PM
Well, not exactly...
I have used:
list($width, $height, $type, $attr) = getimagesize($img);
Then between that code and what's below, some code that will take the oversized $width, $height and try to make then make a new width and height that allows the image to keep the same shape, but be correctly sized.
if($new_width != $width)
$width = $new_width;
$width = $width;
if($new_height != $height)
$height = $new_height;
$height = $height;
$img_code = "<img src='$img' alt='User Image' width='$width' height='$height' />";
The trouble I am having is getting it so that it keeps it the same shape, but can resize it to be as big as it possibly can without streching the page.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.