note 80267 added to function.getimagesize

From: Date: Mon, 07 Jan 2008 12:42:00 +0000
Subject: note 80267 added to function.getimagesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-134917@lists.php.net to get a copy of this message
Seems the various ways people are trying to proportionaly scale an image, up or down, could be more straight forward if one remembers ones algebra. The formula is, y = mx, where m is the slope of the line. This is the ratio of y:x or m = y/x. So if... // max values for x and y $y_max = 600; $x_max = 800; // image size $y1 = 2000; $x1 = 3000; // use width for scaling if ($x1 > $x_max) { // find slope $m = $y1/$x1; // set x side to max $x2 = $x_max; // set y side to a proportional size $y2 = $m * $x1; } The new image proportionally scaled will be x2 = 800, y2 = 533 (rounded). To do it from the y side, simply reverse the x's and y's. ---- Server IP: 208.69.120.35 Probable Submitter: 67.189.120.87 ---- Manual Page -- http://www.php.net/manual/en/function.getimagesize.php Edit -- https://master.php.net/note/edit/80267 Del: integrated -- https://master.php.net/note/delete/80267/integrated Del: useless -- https://master.php.net/note/delete/80267/useless Del: bad code -- https://master.php.net/note/delete/80267/bad+code Del: spam -- https://master.php.net/note/delete/80267/spam Del: non-english -- https://master.php.net/note/delete/80267/non-english Del: in docs -- https://master.php.net/note/delete/80267/in+docs Del: other reasons-- https://master.php.net/note/delete/80267 Reject -- https://master.php.net/note/reject/80267 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#134917) next »