note 102353 deleted from function.getimagesize by cmb
| From: | cmb@php.net | Date: | Sun, 18 Dec 2016 09:37:08 +0000 |
| Subject: | note 102353 deleted from function.getimagesize by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208622@lists.php.net to get a copy of this message | ||
Note Submitter: falkon303 at gmail dot com
----
Here's a simple way to resize your images based on a percentage.
<?php
$image_path = "images/your_image.png";
list($width, $height, $type, $attr)= getimagesize($image_path);
//specify what percentage you are resizing to
$percent_resizing = 80;
$new_width = round((($percent_resizing/100)*$width));
$new_height = round((($percent_resizing/100)*$height));
echo '<img src="'.$image_path.'"
height="'.$new_height.'" width="'.$new_width.'">';
?>