custom fonts on "signs", PHP, 1st step (Wishlist)

custom fonts on "signs", PHP, 1st step // Wishlist

1  |  

ananas

Mar 29, 2001, 5:14pm
This is a multi-part message in MIME format.
--------------DA3920B88D20FDC332A2EF9D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

<?PHP
Header ("Content-type: image/jpeg");
$im = imagecreate (256, 256);

$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);

imagefill ($im, 1, 1, $white);

$font = $HTTP_GET_VARS["f"];
$size = imagefontheight ($font);

$list = explode("|", $HTTP_GET_VARS["t"]);

$pos = 0;
foreach ($list as $line)
{
$line = strtr ($line, "^", " ");
imagestring ($im, $font, 0, $pos, $line, $black);
$pos = $pos + $size;
}

ImageJPEG ($im);
ImageDestroy ($im);
?>

Save this as PHP file jpgtxt.php to your textures folder.


====== USAGE 1 ======

Create a zpict2.rwx with :
create picture jpgtxt.php?f=5&t=HELLO^WORLD|This^is^line^2

The script takes 2 arguments at the moment :
f=5
t=HELLO^WORLD|This^is^line^2

The f= is the font size and can go from 1 up to 5

The t= is the text to show. As you see it uses dashes ^ instead of space
characters and pipes | instead of newline characters.

====== LIMITATIONS ======

Although the script is located in the textures folder "create texture"
doesn't work - it doesn't seem to like those characters.

It doesn't use loadable bitmap fonts yet(!) so the available fonts are
limited to the PHP standard fonts f=1 up to f=5 - not very custom yet
but maybe the first step to custom fonts.

Another improvement will be color and bcolor as arguments instead of
fixed colors in the script.
--------------DA3920B88D20FDC332A2EF9D
Content-Type: text/x-vcard; charset=us-ascii;
name="vha.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Volker Hatzenberger
Content-Disposition: attachment;
filename="vha.vcf"

begin:vcard
n:Hatzenberger;Volker
x-mozilla-html:FALSE
url:oct31.de
adr:;;Bornheimer Strasse 15;Bonn;;53111;Germany
version:2.1
email;internet:vha at oct31.de
end:vcard

--------------DA3920B88D20FDC332A2EF9D--

wing

Mar 29, 2001, 8:18pm
POWERFUL STUFF.
[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn