note 60087 deleted from ref.image by nlopess

From: Date: Mon, 26 Dec 2005 09:31:16 +0000
Subject: note 60087 deleted from ref.image by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100721@lists.php.net to get a copy of this message
Note Submitter: razonklnbd at yahoo dot com ---- I was looking for a function to get propotional image size. After a bit of thinking I came up with this pretty fast solution: <?php function getPropotionalSize($src_w, $src_h, $max_w, $max_h){ $return_val['width']=$src_w; $return_val['height']=$src_h; if($max_w<$src_w || $max_h<$src_h){ $return_val['width']=$max_w; $return_val['height']=$max_h; if($src_w>=$src_h) $return_val['height']=($max_w*$src_h)/$src_w; else $return_val['width']=($max_h*$src_w)/$src_h; } return $return_val; } ?> Hope it saved somebody some time!

« previous php.notes (#100721) next »