note 23354 added to function.imagecopy

From: Date: Tue, 16 Jul 2002 12:25:24 +0000
Subject: note 23354 added to function.imagecopy
Groups: php.notes 
Request: Send a blank email to php-notes+get-33123@lists.php.net to get a copy of this message
Hi! I tried to use the following code with php 4.2.1 and gd 2.0.1 but it won't work. Anyone find's out why not??? Thanx! <? Header("Content-Type: image/jpeg"); #kuvan tuonti $im = @ImageCreateFromJPEG ($hakemisto.'/'.$file); if (!$im) { $im = ImageCreateTrueColor (480, 360); $tc = ImageColorAllocate ($im, 0, 0, 0); ImageString ($im, 4, 2, 0, 'Kuvaa '.$hakemisto.'/'.$file.' ei voitu lada$ ImageJPEG($im,'',45); exit; } ImageDestroy ($im); $size = GetImageSize ($hakemisto.'/'.$file); $teksti = "(c) Heinolan Auto ja Traktori Oy"; ///------------------------------------------------------------- $imageWidth = $size[0]; $imageHeight = $size[1]; //$im = imageCreate( $imageWidth, $imageHeight ); // - with GD 2+ - $im = imageCreateTrueColor($imageWidth,$imageHeight); // do all your color allocations here $font_color = ImageColorAllocate( $im, 0,0,0); $im2 = ImageCreateFromJPEG($hakemisto.'/'.$file); // do all your color allocations here $font_color = ImageColorAllocate( $im, 0,0,0); $im2 = ImageCreateFromJPEG($hakemisto.'/'.$file); ImageCopy ($im,$im2,0,0,0,0, $imageWidth, $imageHeight); ImageDestroy ($im2); ////////--------------------------------------------------------- $tpit = (strlen($teksti)*6.4); if($thumb==0){ ImageJPEG($im,'',45); } if($thumb==1) { $w=ImageSX($im); $h=ImageSY($im); if ($w<$h) { //$ni=ImageCreate(360,480); $ni=ImageCreateTrueColor(360,480); $text_color = ImageColorAllocate( $ni, 0,0,0); //ImageCopyResized($ni,$im,0,0,0,0,360,480,$w,$h); ImageCopyResampled($ni,$im,0,0,0,0,360,480,$w,$h); ImageString ($ni, 3,6,460, $teksti, $text_color); ImageJPEG($ni,'',40);} imagedestroy($im); imagedestroy($ni); else { $ni=ImageCreateTrueColor(480,360); $text_color = ImageColorAllocate( $ni, 0,0,0); //ImageCopyResized($ni,$im,0,0,0,0,480,360,$w,$h); ImageCopyResampled($ni,$im,0,0,0,0,480,360,$w,$h); ImageString ($ni, 3,6,340, $teksti, $text_color); ImageJPEG($ni,'',40);} imagedestroy($im); imagedestroy($ni); } ?> -- http://www.php.net/manual/en/function.imagecopy.php http://master.php.net/manage/user-notes.php?action=edit+23354 http://master.php.net/manage/user-notes.php?action=delete+23354 http://master.php.net/manage/user-notes.php?action=reject+23354

« previous php.notes (#33123) next »