note 54122 added to function.imagecopyresampled
| From: | mikk150 at hot dot ee | Date: | Fri, 24 Jun 2005 10:46:53 +0000 |
| Subject: | note 54122 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90885@lists.php.net to get a copy of this message | ||
i have a little problem in that
that script will resize picture that 1 side is 100px
<?php
$filename = 'kasutajad/thumbs/'.$_GET['fail'];
$max=100;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($filename);
if($width < $height){
$newwidth = $max*($widht/$height);
$newheight = $max;}
if($width == $height){
$newwidth = $max;
$newheight = $max;}
if($width > $height){
$newwidth = $max;
$newheight = $max*($height/$width);}
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb,'',60);
imagedestroy($thumb);
?>
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54122
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54122&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54122&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54122&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54122&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54122&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54122&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54122&report=yes
Search -- http://master.php.net/manage/user-notes.php