note 79173 added to ref.image
| From: | kangaroo232002 at yahoo dot co dot uk | Date: | Wed, 14 Nov 2007 11:51:57 +0000 |
| Subject: | note 79173 added to ref.image | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132268@lists.php.net to get a copy of this message | ||
I have noticed that some functions use quite complicated resizing code, however if you want to
specify just one dimension (e.g. resizing an image for a catalogue or social network etc) then you
can do it my just getting the percentage reduction of one dimension of the image and applying it to
the other, like so:
<?php
$new_width = 150;
//assuming you have already used imageSX(), imageSY() to get the dimensions.
$percentage_reduction = ($new_width / $old_width) * 100;
$new_height = ($old_height / 100) * $percentage_reduction;
?>
This means that images will not be stretched, but will be neater as they are the same width (e.g.
facebook).
----
Server IP: 194.145.210.4
Probable Submitter: 148.197.60.140
----
Manual Page -- http://www.php.net/manual/en/ref.image.php
Edit -- https://master.php.net/note/edit/79173
Del: integrated -- https://master.php.net/note/delete/79173/integrated
Del: useless -- https://master.php.net/note/delete/79173/useless
Del: bad code -- https://master.php.net/note/delete/79173/bad+code
Del: spam -- https://master.php.net/note/delete/79173/spam
Del: non-english -- https://master.php.net/note/delete/79173/non-english
Del: in docs -- https://master.php.net/note/delete/79173/in+docs
Del: other reasons-- https://master.php.net/note/delete/79173
Reject -- https://master.php.net/note/reject/79173
Search -- https://master.php.net/manage/user-notes.php