note 92248 deleted from function.getimagesize by cmb

From: Date: Sun, 18 Dec 2016 09:38:03 +0000
Subject: note 92248 deleted from function.getimagesize by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208625@lists.php.net to get a copy of this message
Note Submitter: anonymous ---- Well there are a lot of image scaling functions here. Here is my take on it. <?php 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; } ?>

« previous php.notes (#208625) next »