note 24975 added to function.imagecopyresized

From: Date: Fri, 06 Sep 2002 13:50:34 +0000
Subject: note 24975 added to function.imagecopyresized
Groups: php.notes 
Request: Send a blank email to php-notes+get-36242@lists.php.net to get a copy of this message
i Use en external file to dynamically generate thumbs -------------------------------- <?php $size = 200; $margin = 2; $jpegdir = 'photo'; $jpeg = $jpegdir .'/'. $HTTP_GET_VARS['img']; $size2 = $HTTP_GET_VARS['newheight']; if($d=getimagesize($jpeg)){ $dim = ($d[1]>$d[0]) ? 1 : 0; $mod = $size / $d[$dim]; $w = (int) ($d[0] * $mod); $h = (int) ($d[1] * $mod); $x = (int)(($size + $margin - $w) / 2); $y = (int)(($size2 + $margin - $h) / 2); header('Content-type: image/jpeg'); $src = imagecreatefromjpeg($jpeg); $dst = imagecreate($size+($margin * 2), $size2+($margin * 2)); $white = imagecolorallocate($dst,0,0,0); imagefill($dst,0,0,$black); imagecopyresized($dst,$src,0,0,0,0,$size+5,$size2+5,$d[0],$d[1]); imagejpeg($dst); imagedestroy($dst); imagedestroy($src); } ?> ------------------------ now the thumbs are available by: <img src=thumb.php?img=$filename&newheight=$newheight> it works cool - i dont care about thumb quality... i need speed my server is amd k62-400 with 64MB of ram and this script is very slow on that machine.. is there any possibility to speed it up? maybe there is a faster, (even less accurate) method to resize the image using GD ? Krynix -- http://www.php.net/manual/en/function.imagecopyresized.php http://master.php.net/manage/user-notes.php?action=edit+24975 http://master.php.net/manage/user-notes.php?action=delete+24975 http://master.php.net/manage/user-notes.php?action=reject+24975

« previous php.notes (#36242) next »