On 8/29/06, Ross <[EMAIL PROTECTED]> wrote:
I have an saved images I output with this...
<img src="includes/viewphoto.php?id=<?=$photo?>">
I want to use getimagesize() to get the height and width of the image and if
it is above a certain size then scale/ reduce it.
The problems are
(i) using getimage() without a url just my viewphoto.php script
I'm not sure what you mean here.
(ii) comparing and reducing the file
reducing a file tends to follow the logic of some sort:
$size = GetImageSize ($image);
$ratio = $size[0]/$size[1];
if ($ratio > 1) {
$width = $max_size;
$height = ($max_size/$size[0]) * $size[1];
} else {
$width = ($max_size/$size[1]) * $size[0];
$height = $max_size;
}
where $max_size is the largest you want your image to be in width,
then just copy it it into a new image create at that size
There are a lot of samples of this on google as jochem suggested.
Curt.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php