<?php
/**********************************************************
* ______ ______ ___ _______ ___ ___ _______ *
* | _ \ | _ \ | | | _ || Y || _ | *
* |. | \|. | \|. | |. 1___||. || 1___| *
* |. | |. | |. |___ |. |___ |. \_/ ||____ | *
* |: 1 |: 1 |: 1 ||: 1 ||: | ||: 1 | *
* |::.. . /|::.. . /|::.. . ||::.. . ||::.|:. ||::.. . | *
* `------' `------' `-------'`-------'`--- ---'`-------' *
* _______ _______ *
* .--.--. | _ | | | *
* | | | |___| | __ |___| | *
* \___/ _(__ | |__| / ___/ *
* |: 1 | |: 1 \ *
* |::.. . | |::.. . | *
* `-------' `-------' *
* *
* Script: DDLCMS v3.2 *
* Author: Little Dragon *
* Email: hide@address.com *
* Website: http://www.ddlcms.com *
* *
* Please direct bug reports, suggestions or feedback *
* to the DDLCMS forums: *
* *
* http://www.ddlcms.com/forums *
* *
* DDLCMS is a commercial grade content management *
* system for DDL site owners. It is provided free *
* of charge, provided: *
* *
* 1. You keep the linkback to http://www.ddlcms.com *
* in the footer. *
* *
* 2. You keep the sponsored links to Sharingzone.net *
* on your site. *
* *
* By using this script, you agree that you will not *
* modify, remove, or replace any encoded parts of *
* this script. All encoded parts MUST remain intact *
* for your site to remain in good standing. *
* *
**********************************************************/
define('WWWROOT', dirname(__FILE__) . '/');
define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
require(BASEDIR . 'funcs.inc');
/*
Create buttons on the fly with PHP
---------------------------------------------------------------------------
author: hide@address.com, http://www.circle.ch
update: 16-5-2000
PHP: php-3.0.11-win32
file(s): 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;
}
if(checkURLQuery('button.php', $_GET) === TRUE)
{
$width = strlen($_GET['txt']) * ImageFontWidth(TextFONT);
$offset = 2;
$imgFRAME = ImageCreate($width, ImageFontHeight(TextFONT)+$offset);
list($red, $green, $blue) = ConvertColor($_GET['bg']);
$bgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);
list($red, $green, $blue) = ConvertColor($_GET['fg']);
$fgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);
ImageFill($imgFRAME, 1, 1, $bgCOLOR);
ImageString($imgFRAME, TextFONT, 1, 1, $_GET['txt'], $fgCOLOR);
header('Content-type: image/gif');
ImageGIF($imgFRAME);
ImageDestroy($imgFRAME);
}
?>