Fatal error: Call to unsupported or undefined function imagefontwidth() in /button.php3 on line 29
Here's button.php3...
<?php
/*
Create buttons on the fly with PHP
author: Copyright (c) by Urs Gehrig, <admin@circle.ch>
source: http://www.circle.ch/scripts/code/button.zip
update: 24-6-2000
PHP: php-4.0-win32
dll: php_gd.dll (compilation by Sunny Wang)
file: button.php
syntax: for testing:
http://localhost/button.php?fg=990000&bg=ffffff&txt=button one
for inclusion (see also test.htm):
<img src="button.php?fg=990000&bg=ffffff&txt=button one" border="0">
settings: $bg = background color , hexadecimal
$fg = foreground color , hexadecimal
hexadecimal order : RGB (each 2byte)
*/
define("TextFONT", "3");
function ConvertColor($hexVal){
$ColorVal = array(3);
for($i = 0; $i < 3; $i++)
$ColorVal[$i] = HexDec(substr($hexVal, $i * 2, 2));
return $ColorVal;
}
$width = strlen($txt) * imagefontwidth(TextFONT);
$offset = 2;
$imgFRAME = ImageCreate($width, imagefontheight(TextFONT)+$offset);
list($red, $green, $blue) = ConvertColor($bg);
$bgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);
list($red, $green, $blue) = ConvertColor($fg);
$fgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);
ImageFill($imgFRAME, 1, 1, $bgCOLOR);
ImageString($imgFRAME, TextFONT, 1, 1, $txt, $fgCOLOR);
header("Content-type: image/gif");
ImageGIF($imgFRAME);
ImageDestroy($imgFRAME);
?>
Any ideas??
I'd really like to start using the image commands in php but cannot even get a pre-written script to work on my server...