note 22802 deleted from function.imagecopyresampled by aidan
| From: | aidan@php.net | Date: | Mon, 04 Oct 2004 09:45:21 +0000 |
| Subject: | note 22802 deleted from function.imagecopyresampled by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77967@lists.php.net to get a copy of this message | ||
Note Submitter: billy at frostytomato dot com
----
If you want to maintain the same ratio's but still fit it into a predetermined box, do this:
//assume you have a variable (w) for max width allowed
$new_width = ($src_width * $dest_height) / $src_height;
if ($new_width > $w) {
$new_width = $w;
$dest_height = ($src_height * $new_width) / $src_width;
}