note 100516 deleted from function.imagecopyresampled by danbrown
| From: | danbrown@php.net | Date: | Thu, 21 Oct 2010 00:38:57 +0000 |
| Subject: | note 100516 deleted from function.imagecopyresampled by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173326@lists.php.net to get a copy of this message | ||
Note Submitter: me at 3000farad dot com
----
<?php
if (($originalHeight/$maxHeight) > ($originalWidth/$maxWidth)) { // The height is the
independent factor, width is dependent
$finalHeight = min($originalHeight,$maxHeight); // Doesn't change the size if it's under
the max (prevents enlargement)
$finalWidth = round($originalWidth*($finalHeight/$originalHeight));
}
else { // The width is independent, or it doesn't matter (the aspect ratio of the original and
the max are the same)
$finalWidth = min($originalWidth,$maxWidth);
$finalHeight = round($originalHeight*($finalWidth/$originalWidth));
}
?>