getimagesize/if statement problem
Posted: Thu Nov 01, 2007 10:10 am
I have the following code which is supposed to make an image fit inside a 250x250 table cell.
When $ix and $iy are echoed, the correct numbers are produced, but the if statement always produces the results as if $iy is greater. Am I missing something simple?
Code: Select all
$imageinfo = getimagesize("$imagelocation");
$ix=$imageinfo[0];
$iy=$imageinfo[1];
if (iy>ix)
{
$nheight=$iy/$iy*250;
$nwidth=$ix/$iy*250;
$test="y";
}
else
{
$nheight=$iy/$ix*250;
$nwidth=$ix/$ix*250;
$test="x";
}
echo "' width='".$nwidth."' height='".$nheight."'/></a></center>". $ix.$iy.$test."