note 86344 added to function.imagecopyresampled
| From: | matt at rees-jenkins dot co dot uk | Date: | Tue, 14 Oct 2008 10:32:18 +0000 |
| Subject: | note 86344 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145337@lists.php.net to get a copy of this message | ||
A tiny ammendment to zorroswordsman at gmail dot com's resize class. It was only resizing if
both the width AND height where greater than the desired size. This should fix it:
<?php
// Set maximum image size (pixels)
function set_size($size = 100)
{
// Resize
if($this->x_input > $size || $this->y_input > $size)
{
// Wide
if($this->x_input >= $this->y_input)
{
$this->x_output = $size;
$this->y_output = ($this->x_output / $this->x_input) * $this->y_input;
}
// Tall
else
{
$this->y_output = $size;
$this->x_output = ($this->y_output / $this->y_input) * $this->x_input;
}
// Ready
$this->resize = TRUE;
}
// Don't resize
else { $this->resize = FALSE; }
}
?>
----
Server IP: 92.48.74.199
Probable Submitter: 80.229.205.37
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- https://master.php.net/note/edit/86344
Del: integrated -- https://master.php.net/note/delete/86344/integrated
Del: useless -- https://master.php.net/note/delete/86344/useless
Del: bad code -- https://master.php.net/note/delete/86344/bad+code
Del: spam -- https://master.php.net/note/delete/86344/spam
Del: non-english -- https://master.php.net/note/delete/86344/non-english
Del: in docs -- https://master.php.net/note/delete/86344/in+docs
Del: other reasons-- https://master.php.net/note/delete/86344
Reject -- https://master.php.net/note/reject/86344
Search -- https://master.php.net/manage/user-notes.php