note 53376 deleted from function.getimagesize by cmb

From: Date: Sun, 18 Dec 2016 09:34:06 +0000
Subject: note 53376 deleted from function.getimagesize by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208619@lists.php.net to get a copy of this message
Note Submitter: Sean ---- I needed a quick way to make a group of images uniformly sized, but only on one page. So creating a new set of thumbnails was overdoing the whole thing. I made up this script that seems to do the trick. <?php $image = "absolute/path/to/image/image.jpg"; $size = getimagesize("$image"); $height = $size[1]; $width = $size[0]; if ($height > 150) { $height = 150; $percent = ($size[1] / $height); $width = ($size[0] / $percent); } else if ($width > 150) { $width = 150; $percent = ($size[0] / $width); $height = ($size[1] / $percent); } echo "<img src\"image/path/image.jpg\" height=\"$height\" width=\"$width\" />"; ?>

« previous php.notes (#208619) next »