note 7074 modified in Image functions by ronabop

From: Date: Wed, 04 Oct 2000 14:47:40 +0000
Subject: note 7074 modified in Image functions by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-6030@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:-') http://www.php.net/manual/image-functions.php

« previous php.notes (#6030) next »