Re: picture editing

From: Date: Mon, 05 Aug 2002 15:56:55 +0000
Subject: Re: picture editing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-111221@lists.php.net to get a copy of this message
>From: "olev rumm" <info@toolmecindustries.com> >Sent: Monday, August 05, 2002 11:30 AM >Subject: [PHP] picture editing > Hello Gurus. > Any good links from where I can find how to edit pictures in PHP. > I want to generate a text (like 01,02,03 etc.)on every picture after the > customer loads the picture in to my database.How to do it. This is from a presentation by Rasmus that does what you want using gd and libpng. It will center the text on the image. It's a good place to start. <?php Header("Content-type: image/png"); $font = "php.ttf"; if(!$si) $si = 66; $im = ImageCreateFromPNG("php-blank.png"); $tsize = imagettfbbox($si,0,$font,$text); $dx = abs($tsize[2]-$tsize[0]); $dy = abs($tsize[5]-$tsize[3]); $x = ( imagesx($im) - $dx ) / 2; $y = ( imagesy($im) - $dy ) / 2 + 3*$dy/4; $blue = ImageColorAllocate($im,0x5B,0x69,0xA6); $white = ImageColorAllocate($im,255,255,255); $black = ImageColorAllocate($im,0,0,0); ImageTTFText($im, $si, 0, $x, $y, $white, $font, $text); ImageTTFText($im, $si, 0, $x+2, $y, $white, $font, $text); ImageTTFText($im, $si, 0, $x, $y+2, $white, $font, $text); ImageTTFText($im, $si, 0, $x+2, $y+2, $white, $font, $text); ImageTTFText($im, $si, 0, $x+1, $y+1, $black, $font, $text); ImagePNG($im); ?> Use like: <IMG src="txt2.php?text=<?echo urlencode($text)?>&si=<?echo $si?>">

« previous php.general (#111221) next »