note 19745 added to function.getimagesize
| From: | mogster at boomdesign dot no | Date: | Sat, 09 Mar 2002 15:58:55 +0000 |
| Subject: | note 19745 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27552@lists.php.net to get a copy of this message | ||
Really useful info from webmasterb@feartheclown.com and you others :-)
Saved my butt...
Here's a build on that, with proportional resizing of the image-upload ($newpic) to a fixed
value ($maxwidth):
$maxwidth = "350";
$imagehw = GetImageSize($newpic);
$imagewidth = $imagehw[0];
$imageheight = $imagehw[1];
$imgorig = $imagewidth;
if ($imagewidth > $maxwidth {
$imageprop=($maxwidth*100)/$imagewidth;
$imagevsize= ($imageheight*$imageprop)/100 ;
$imagewidth=$maxwidth;
$imageheight=ceil($imagevsize);
}
Of course this does not resize the image itself, but returns values one may use in html-code to
restrain users from killing your design...
knutm
--
http://www.php.net/manual/en/function.getimagesize.php
http://master.php.net/manage/user-notes.php?action=edit+19745
http://master.php.net/manage/user-notes.php?action=delete+19745
http://master.php.net/manage/user-notes.php?action=reject+19745