note 92248 added to function.getimagesize
| From: | anonymous at osu1 dot php dot net | Date: | Wed, 15 Jul 2009 20:37:47 +0000 |
| Subject: | note 92248 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158351@lists.php.net to get a copy of this message | ||
Well there are a lot of image scaling functions here. Here is my take on it.
<?
function get_scaled_dim_array($img,$max_w = 100, $max_h = NULL){
if(is_null($max_h)){
$max_h = $max_w;
}
if (file_exists($img)){
list($img_w,$img_h) = getimagesize($img);
$f = min($max_w/$img_w, $max_h/$img_h, 1);
$w = round($f * $img_w);
$h = round($f * $img_h);
return array($w,$h);
}
return NULL;
}
?>
----
Server IP: 209.41.74.194
Probable Submitter: 128.187.0.164
----
Manual Page -- http://www.php.net/manual/en/function.getimagesize.php
Edit -- https://master.php.net/note/edit/92248
Del: integrated -- https://master.php.net/note/delete/92248/integrated
Del: useless -- https://master.php.net/note/delete/92248/useless
Del: bad code -- https://master.php.net/note/delete/92248/bad+code
Del: spam -- https://master.php.net/note/delete/92248/spam
Del: non-english -- https://master.php.net/note/delete/92248/non-english
Del: in docs -- https://master.php.net/note/delete/92248/in+docs
Del: other reasons-- https://master.php.net/note/delete/92248
Reject -- https://master.php.net/note/reject/92248
Search -- https://master.php.net/manage/user-notes.php