I have the GD library installed and running. I can't get this script to work, any suggestions? The picture displays, but not at the size I want.
Quote:
<?php
function imageResize($width, $height, $target) {
//the math to resize the picture maintaining ratio
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
return "width=\"$width\" height=\"$height\"";
}
?>
<?php
//get the image size of the picture
$thumbpic = getimagesize("admin/photos/321-30853-Turpin.JPG");
?>
img src="admin/photos/321-30853-Turpin.JPG" <?php imageResize($thumbpic[0], $thumbpic[1],150); ?>>
|
the image tag here is missing the opening bracket to help it display properly, in my script it is there.