note 97564 added to function.getimagesize
| From: | modnyj at gmail dot com | Date: | Mon, 26 Apr 2010 11:34:24 +0000 |
| Subject: | note 97564 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168643@lists.php.net to get a copy of this message | ||
<?
// A simplest method to resize a image keeping the constraint proportions
// Constraints
$max_width = 100;
$max_height = 100;
list($width, $height) = getimagesize($img_path);
$ratioh = $max_height/$height;
$ratiow = $max_width/$width;
$ratio = min($ratioh, $ratiow);
// New dimensions
$width = intval($ratio*$width);
$height = intval($ratio*$height);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.149.133.122
----
Manual Page -- http://www.php.net/manual/en/function.getimagesize.php
Edit -- https://master.php.net/note/edit/97564
Del: integrated -- https://master.php.net/note/delete/97564/integrated
Del: useless -- https://master.php.net/note/delete/97564/useless
Del: bad code -- https://master.php.net/note/delete/97564/bad+code
Del: spam -- https://master.php.net/note/delete/97564/spam
Del: non-english -- https://master.php.net/note/delete/97564/non-english
Del: in docs -- https://master.php.net/note/delete/97564/in+docs
Del: other reasons-- https://master.php.net/note/delete/97564
Reject -- https://master.php.net/note/reject/97564
Search -- https://master.php.net/manage/user-notes.php