note 41619 deleted from function.imagecopyresampled by aidan
| From: | aidan@php.net | Date: | Mon, 04 Oct 2004 09:43:01 +0000 |
| Subject: | note 41619 deleted from function.imagecopyresampled by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77944@lists.php.net to get a copy of this message | ||
Note Submitter:
----
another scale size calculation function that figures out how to best stuff a big image into a little
space or vise versa.
<?php
function CalcScrunchSize($CurH,$CurW,$MaxH,$MaxW) //calculates how to stuff a big img into a lil
space
{
$HRatio = $CurH/$maxH;
$WRatio = $CurW/$MaxW;
if($HRatio > $WRatio)
{
$result[0] = $CurW*($MaxH/$CurH);
$result[1] = $MaxH;
}
else
{
$result[0] = $MaxW;
$result[1] = $CurH*($MaxW/$CurW);
}
return($result);
}
?>