|
|
#1 | ||
|
Junior Member
Join Date: Jan 2010
Location: London, UK
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
|
It's a font viewer, like on dafont.com.
Here is my index.php... <?php $dir = scandir('font/vera/'); unset($dir[0], $dir[1]); foreach($dir as $item){ if(substr($item, -4) == '.ttf'){ echo '<a href="./index.php?font='.$item.'">'.$item.'</a>' . chr(10); } } if($font = $_GET['font']){ if(in_array($font, $dir)){ echo '<img src="create-image.php?font='.substr($font, 0, -4).'"/>' . chr(10); echo '<a href="font/vera/'.$font.'"><img src="http://www.motionintype.com/database/download.png" alt="Download link"/></a>' . chr(10); } } ?> And here is my create-image.php... <?php $font = $_GET['font']; if(file_exists('font/vera/' . $font . '.ttf')){ header('Content-type: image/png'); $image = imagecreatetruecolor(500, 100); $bg = imagecolorallocate($image, 255, 255, 255); imagefilledrectangle($image, 0, 0, 500, 100, $bg); $text_color = imagecolorallocate($image, 0, 0, 0); imagettftext($image, 20, 0, 0, 60, $text_color, 'font/vera/' . $font . '.ttf', 'Preview'); imagepng($image); imagedestroy($image); } ?> Basically, I want the preview to just come up...rather than having to click on a link to preview it. Link: Free Font & Typeface Downloads, Tools, Tutorials & Software. thanks! |
||
|
|
|
![]() |
| Tags |
| font viewer, motion in type, php |
| Thread Tools | |
| Display Modes | |
|
|