note 71399 added to function.imagettftext

From: Date: Mon, 27 Nov 2006 04:01:48 +0000
Subject: note 71399 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-120096@lists.php.net to get a copy of this message
If you want to display a list of fonts in a directory and see what they look like, you could do something like this: <HTML><BODY> <?php $folder=dir("fonts/"); //The directory where your fonts reside while($font=$folder->read()) { if(stristr($font,'.ttf'))echo '<IMG SRC="img.php?'.substr($font,0,strpos($font,'.')).'">'; //only ttf fonts } $folder->close(); ?> </BODY></HTML> The file for 'img.php' should be something like this: <?php $font=$_SERVER["QUERY_STRING"]; header("Content-type: image/png"); $im=@imagecreatetruecolor(200,30)or die("Cannot Initialize new GD image stream"); $black=imagecolorallocate($im,0,0,0); $white=imagecolorallocate($im,255,255,255); imagefill($im,0,0,$white); imagettftext($im,18,0,5,25,$black,"fonts/".$font,$font); imagepng($im); imagedestroy($im); ?> Something similar I implemented at http://font.beginstart.com ---- Server IP: 62.237.7.3 Probable Submitter: 84.231.43.173 ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- https://master.php.net/note/edit/71399 Del: integrated -- https://master.php.net/note/delete/71399/integrated Del: useless -- https://master.php.net/note/delete/71399/useless Del: bad code -- https://master.php.net/note/delete/71399/bad+code Del: spam -- https://master.php.net/note/delete/71399/spam Del: non-english -- https://master.php.net/note/delete/71399/non-english Del: in docs -- https://master.php.net/note/delete/71399/in+docs Del: other reasons-- https://master.php.net/note/delete/71399 Reject -- https://master.php.net/note/reject/71399 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120096) next »