note 23354 deleted from function.imagecopy by dams

From: Date: Tue, 30 Jul 2002 11:01:16 +0000
Subject: note 23354 deleted from function.imagecopy by dams
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-33981@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); } ?>

« previous php.notes (#33981) next »