Add your company details to our Business Directory, for FREE!


Graphic Design Forums: UK forums for graphic designers » Website Design Forums: » Website Coding & Programming Forum: » PHP Font Vewier Problem

Reply
Old 02-05-2010, 04:39 PM   #1
Junior Member
 
Join Date: Jan 2010
Location: London, UK
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Unhappy PHP Font Vewier Problem

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!
Airwalk Enterprise, Inc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Twit this!
Reply With Quote
Reply

Tags
font viewer, motion in type, php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Flyer Printing | Print Reseller Scheme | Graphic Design | Logo Designer | Web Design UK | Graphic Design UK | Letterhead Printing
Business Card Printing | UK Business Forum | Logo Designer | NCR Pads | NCR Books | Receipt Books | Drinks Coasters | A6 Flyers | A5 Leaflets
Web Design & Development | vBulletin Skins | Small Business Websites | Leaflets | Leaflet Printing | Web Design Liverpool | Invoice Books


DISCLAIMER: All posts on this forum express the views and opinions of the author only, not the owners, staff or advertisers, hence we will not be held liable.


Powered by vBulletin®
© Copyright Jelsoft Enterprises Ltd
SEO by vBSEO 3.2.0 RC5 ©2008, Crawlability, Inc.