PHP Code:
<?php
//Font Previewer
$fontdir = '/fonts';
// The list of font filenames, together with their names.
// Use the format provided here in the example.
$fontnames = array (
'Ac.ttf' => 'AC',
'aftermat.ttf' => 'Aftermath',
'airmole.ttf' => 'Airmole',
'AlbertText-Bold.ttf' => 'Albert Text Bold',
'amsterdam.ttf' => 'Amsterdam',
'ANGLEPOI.TTF' => 'Anglepoise Lampshade',
'ANKLEPAN.TTF' => 'Ankle Pan',
'ArgosGeorge.ttf' => 'Argos George',
'arialbd.ttf' => 'Arial Bold',
'astronbo.ttf' => 'Astron Boy',
'Becker.ttf' => 'Becker',
'Bloody.ttf' => 'Bloody',
'CURLZ.TTF' => 'Curlz',
'darkside.ttf' => 'Darkside',
'DIRTYDOZ.TTF' => 'Dirty Dozen',
'FELTMARI.TTF' => 'Feltmark',
'FIRESTARTER.TTF' => 'FireStarter',
'FLUBBER.TTF' => 'Flubber',
'gestures.ttf' => 'Gestures',
'GHOSTWRITER.TTF' => 'Ghostwriter',
'GREENFUZ.TTF' => 'GreenFuzz',
'HEMIHEAD.TTF' => 'HemiHead 426',
'hotpizza.ttf' => 'Hot Pizza',
'jmacscrl.ttf' => 'Johnny Mac Scrawl',
'johnnyfe.ttf' => 'Johnny Fever',
'Karate.ttf' => 'Karate',
'OASIS.TTF' => 'Oasis',
'Oktoberfest.ttf' => 'Oktoberfest',
'oliver.ttf' => 'Oliver',
'Oreos.ttf' => 'Oreos',
'Paintdrp.ttf' => 'Paint Drip',
'PEANUTS.TTF' => 'Peanuts',
'pirulen.ttf' => 'Pirulen',
'Plain Black Wide.ttf' => 'Plain Black WIde',
'ROCKB.TTF' => 'Rockwell Bold',
'Scood.ttf' => 'Scooby Doo',
'Simpsonfont.ttf' => 'Simpson',
'Sixties.ttf' => 'Sixties',
'Speedline.ttf' => 'Speed Line',
'tahoma.ttf' => 'Tahoma',
'UNDERGRO.TTF' => 'Underground',
'verdana.ttf' => 'Verdana',
'Yahoo.ttf' => 'Yachoo',
'yoshisst.ttf' => 'Yoshis Story',
'ZEROGIRL.TTF' => 'Zero Girl',
);
// Everything below this comment can remain unchanged.
$text = stripslashes($_GET['text']);
$filename = escapeshellarg($_GET['filename']);
$filename = substr(1,strlen($filename) - 2,$filename);
$size = $_GET['size'];
if (isset($_GET['render'])) {
Header ("Content-type: image/png");
$fonturl = $fontdir.'/'.$filename;
$textdims = ImageTTFBBox($size, 0, $fonturl, $text);
$im = imagecreate ($textdims[2]-$textdims[6]+10, $textdims[3]-$textdims[7]+10);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageTTFText ($im, $size, 0, 0, -$textdims[5], $black, $fonturl, $text);
ImagePng ($im);
ImageDestroy ($im);
die();
} else {
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>YakTagz Live Font Previewer</title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
<!--
body {
font-family:georgia, verdana;
scrollbar-base-color:white; s
crollbar-face-color:white;
scrollbar-track-color:white;
scrollbar-highlight-color:white;
scrollbar-shadow-color:white;
scrollbar-darkshadow-color:white;
scrollbar-arrow-color:white
background-color: #FFF;
color: #000;
}
h1 {
font-family: trebuchet ms, verdana
}
a:link, a:visited {
color:blue;
text-decoration:underline
}
a:active, a:hover {
color:red;
text-decoration:none
}
-->
</style>
</head>
<body>
<div id="container">
<h1 style="text-align: center;">Live Text Preview</h1>
<br />
<div style="text-align: center;">
<form method="get">
<table>
<tr>
<td>
<p>Select Font:
<select name="filename">
<?php
foreach ($fontnames as $thisfile => $thisname) {
printf(
'<option%s value="%s">%s</option>'."\n",
($filename == $thisfile)?' selected="selected"':'',
$thisfile,
$thisname
);
}
?>
</select>
</p>
<p>
<input type="hidden" name="size" value="<? if (!$size) echo "52"; else echo $size; ?>" />
</p>
<p>
Text to preview:
<textarea name="text" cols="15" rows="1"><?php
if(isset($text))
echo $text;
?></textarea>
</p>
</td>
</tr>
</table>
<p>
<input type="submit" value="Preview Yaktag" />
</p>
</form>
</div>
<?php
if(isset($filename) && isset($text)) { ?>
<div style="text-align: center;">
<p>
<img <?php
echo 'src="'.$_SERVER['PHP_SELF']."?render=1&filename=$filename&size=$size&text=".urlencode($text).'"';
?> />
</p>
</div>
<?php
}
?>
<div style="text-align: center;">
<a href="ordertagz.htm" target="_blank">Order Your YakTagz Now</a>
<br />
<br />
<br />
If you have a specific font that is not listed, <a href="mailto:sales@yaktagz.com">Contact us</a> to workout the details.
Due to the vast number of fonts available, we only list a small percentage of the font choices available.
</div>
</div>
</body>
</html>
I don't think it's possible to put images in a selectbox. You could do a background-image on each of the elements though.
Bookmarks