i need a image re size code that takes a image and display the according to desired pixels. i have following code but its not working. it just shows the original image.

function imageResize($width, $height, $target) {

//takes the larger size of the width and height and applies the  
//formula accordingly...this is so this script will work  
//dynamically with any size image

if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);

//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);

//returns the new sizes in html image tag format...this is so you
//can plug this function inside an image tag and just get the

return "width=\"$width\" height=\"$height\"";




//get the image size of the picture and load it into an array
$mysock = getimagesize("atgtire.jpg");


<!-using a standard html image tag, where you would have the  
width and height, insert your new imageResize() function with  
the correct attributes -->

<img src="atgtire.jpg" <?php imageResize($mysock[0],  
$mysock[1], 300); ?>>
8 Years
Discussion Span
Last Post by ShawnCplus
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.