note 54122 rejected from function.imagecopyresampled by nlopess
| From: | nlopess@php.net | Date: | Fri, 24 Jun 2005 11:35:42 +0000 |
| Subject: | note 54122 rejected from function.imagecopyresampled by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90886@lists.php.net to get a copy of this message | ||
Note Submitter: mikk150 at hot dot ee
----
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);
?>