note 22802 added to function.imagecopyresampled
| From: | billy at frostytomato dot com | Date: | Sun, 30 Jun 2002 17:47:16 +0000 |
| Subject: | note 22802 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32444@lists.php.net to get a copy of this message | ||
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;
}
--
http://www.php.net/manual/en/function.imagecopyresampled.php
http://master.php.net/manage/user-notes.php?action=edit+22802
http://master.php.net/manage/user-notes.php?action=delete+22802
http://master.php.net/manage/user-notes.php?action=reject+22802