I’m trying to resize an image and here is a script I’m using.
However, the error I get is as follows:
[code=php]Warning: getimagesize(/v1dev/listingpicdir/17a8785ebe2665e197426ae6e9f80944/7tx.gif) [function.getimagesize]: failed to open stream: No such file or directory in ……etc.etc…
I can assure you that the above directory holds the image called 7tx.gif and that is not the issue…
however, the function getimagesize() fails to return anything…
and as a result the script below fails since it will not divide by ZERO.
here is the script
[code=php]//simple emaige resizing
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…
return “width=”$width” height=”$height””;
}
Your help/advice is appreciated.
Thank you.