note 7074 modified in ref.image by irc-html

From: Date: Sun, 20 Jan 2002 00:25:47 +0000
Subject: note 7074 modified in ref.image by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25537@lists.php.net to get a copy of this message
After a day's worth of hassle, I discovered that the solution to making gifs (no LZW so it's legal) is to use ImageMagick. You can get it at ftp://ftp.wizards.dupont.com/pub/ImageMagick/ImageMagick-5.2.2.tar.gz The following code works: <?php $fonts=Array('coolvet.ttf','doodle.ttf','gas.ttf', 'guinea.ttf','hijinx.ttf','hypno.ttf'); $fontname='/home/eric/public_html/imagephp/'.$fonts[$font]; list($llx,$lly,$lrx,$lry,$urx,$ury,$ulx,$uly)=imageTTFbbox($size,0,$fontname,$text); $id=imagecreate(abs($urx-$ulx)+10,abs($lly-$ury)+8); $black= ImageColorAllocate($id, 0, 0, 0); $white= ImageColorAllocate($id, 250, 250, 250); imagefill($id,0,0,$white); imagettftext($id,$size,0,0,abs($ury-$lry)+2,$black,$fontname,$text); Header("Content-type: image/gif"); ImagePNG($id,"/tmp/test.png"); passthru("/usr/local/bin/convert /tmp/test.png gif:-"); imagedestroy($id) ?> Now if there was only a way to get ImagePNG to output to a pipe, we could use: ImagePNG($id,'|/usr/local/bin/convert png:- gif:-') --was-- After a day's worth of hassle, I discovered that the solution to making gifs (no LZW so it's legal) is to use ImageMagick. You can get it at ftp://ftp.wizards.dupont.com/pub/ImageMagick/ImageMagick-5.2.2.tar.gz The following code works: <?php $fonts=Array('coolvet.ttf','doodle.ttf','gas.ttf', 'guinea.ttf','hijinx.ttf','hypno.ttf'); $fontname='/home/eric/public_html/imagephp/'.$fonts[$font]; list($llx,$lly,$lrx,$lry,$urx,$ury,$ulx,$uly)=imageTTFbbox($size,0,$fontname,$text); $id=imagecreate(abs($urx-$ulx)+10,abs($lly-$ury)+8); $black= ImageColorAllocate($id, 0, 0, 0); $white= ImageColorAllocate($id, 250, 250, 250); imagefill($id,0,0,$white); imagettftext($id,$size,0,0,abs($ury-$lry)+2,$black,$fontname,$text); Header("Content-type: image/gif"); ImagePNG($id,"/tmp/test.png"); passthru("/usr/local/bin/convert /tmp/test.png gif:-"); imagedestroy($id) ?> Now if there was only a way to get ImagePNG to output to a pipe, we could use: ImagePNG($id,'|/usr/local/bin/convert png:- gif:-') http://www.php.net/manual/en/ref.image.php

« previous php.notes (#25537) next »