Revision history for BannerMaker


Revision [19361]

Last edited on 2008-01-28 00:15:26 by GmBowen [Modified links pointing to docs server]

No Differences

Revision [17572]

Edited on 2007-10-01 16:18:03 by GmBowen [Link Update]
Additions:
http://gmbtst.msvu.ca/wikitest/bannermaker.jpg
Deletions:
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg


Revision [17462]

Edited on 2007-09-01 15:12:31 by DavePreston [reverted]
Additions:
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size & font.
* USE: {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, blacktext, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
* @author GmBowen (http://wikka.jsnx.com/GmBowen) (with help from JavaWoman), licensed under GPL
*
* REQUIRES GD2 on the server
*
* TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
*/
// set up variables
$site_base = $this->GetConfigValue("base_url");
// Below line might need to be modified to whatever is appropriate for your installation .... 'wikka.php?wakka='
if ( substr_count($site_base, 'wakka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$generator = $site_base."actions/bannergenerator.php?";
$buttoncolor = $bgcolor;
// Set below fonts to those present in fonts directory (which the admin makes in the actions directory)
// Set the first font to that which you wish to be your default if a font isn't specified
// The administrator can add as many different fonts as they wish
if(!$font) {$font = "1";}
if ($font == "1"){$font = "verdana.ttf";}
if ($font == "2"){$font = "toby.ttf";}
if ($font == "3"){$font = "times.ttf";}
if ($font == "4"){$font = "vera.ttf";}
if ($font == "5"){$font = "oldeng.ttf";}
if ($font == "6"){$font = "courierbld.ttf";}
// create img tag
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
?>
%%
This file is REQUIRED in a directory called ##scripts## in the wikka root as ##bannergenerator.php##
<?
// Adapted from a script provided at http://www.geek247.net/ and originally written by
// William Magliano. Modified by GMBowen 2005 for inclusion in Wikka Wiki &
// functionality increased. Released under GPL.
// Script REQUIRES GD2 on the server
$font_file = "./fonts/$font_file";
$defaultFontSize = 12;
if(!$font_size)// If no font size has been passed default to 12pt.
{
$font_size = $defaultFontSize;
}
$angle = 0;
$defaultbgColor = "blue";
$defaulttxtColor = "black";
if(!$buttoncolor)//If no button color is passed make it Blue.
{
$buttoncolor = $defaultbgColor;
}
if(!$textcolor)//If no text color is passed make it Black.
{
$textcolor = $defaulttxtColor;
}
//$textcolor= "red";
$y_start = $font_size*1.5;
$x_start = 5;
$double_text = $text;
$height = $font_size*2;
$bounding_box = imagettfbbox($font_size, 0, $font_file, $text);
$max_width = $bounding_box[2] - $bounding_box[0]+12;
// Create image and allocate colors
$im = imagecreate(($max_width+2), /*15*/$height);
$matte = imagecolorallocate($im, 153, 153, 153);
// allocate code for colors for background
if($buttoncolor == "blue")
{
$outline = imagecolorallocate($im, 0, 105, 179);// dark
$shadow = imagecolorallocate($im, 113, 196, 240);// light
$background = imagecolorallocate($im, 153, 176, 200);//lighter - brighter
$hilite = imagecolorallocate($im, 240, 243, 247);//lightest

}
if($buttoncolor == "red")
{
$outline = imagecolorallocate($im, 255,0,0);// dark
$shadow = imagecolorallocate($im,255,51,51);// light
$background = imagecolorallocate($im, 255,102,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,204);//lightest
}
if($buttoncolor == "purple")
{
$outline = imagecolorallocate($im, 255,0,255);// dark
$shadow = imagecolorallocate($im,255,51,255);// light
$background = imagecolorallocate($im, 255,102,255);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,255);//lightest
}
if($buttoncolor == "yellow")
{
$outline = imagecolorallocate($im, 153,153,51);// dark
$shadow = imagecolorallocate($im,204,204,102);// light
$background = imagecolorallocate($im,255,255,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,204);//lightest
}
if($buttoncolor == "green")
{
$outline = imagecolorallocate($im, 0,153,0);// dark
$shadow = imagecolorallocate($im,0,204,0);// light
$background = imagecolorallocate($im,102,204,102);//lighter - brighter
$hilite = imagecolorallocate($im, 204,255,204);//lightest
}
if($buttoncolor == "grey")
{
$outline = imagecolorallocate($im, 102,102,102);// dark
$shadow = imagecolorallocate($im,153,153,153);// light
$background = imagecolorallocate($im,204,204,204);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,255);//lightest
}
if($buttoncolor == "white")
{
$outline = imagecolorallocate($im, 255,255,255);// white
$shadow = imagecolorallocate($im,255,255,255);// white
$background = imagecolorallocate($im,255,255,255);// white
$hilite = imagecolorallocate($im, 255,255,255);// white
}
if($buttoncolor == "black")
{
$outline = imagecolorallocate($im, 0,0,0);// black
$shadow = imagecolorallocate($im,0,0,0);// black
$background = imagecolorallocate($im,0,0,0);// black
$hilite = imagecolorallocate($im, 0,0,0);// black
}
// allocate code for colors for the text
if($textcolor == "blue")
{
$text_color = imagecolorallocate($im, 153, 176, 200);
}
if($textcolor == "red")
{
$text_color = imagecolorallocate($im, 255, 102, 102);
}
if($textcolor == "purple")
{
$text_color = imagecolorallocate($im, 255, 102, 255);
}
if($textcolor == "yellow")
{
$text_color = imagecolorallocate($im, 255, 255, 102);
}
if($textcolor == "green")
{
$text_color = imagecolorallocate($im, 102, 204, 102);
}
if($textcolor == "grey")
{
$text_color = imagecolorallocate($im, 204, 204, 204);
}
if($textcolor == "white")
{
$text_color = imagecolorallocate($im, 255, 255, 255);
}
if($textcolor == "black")
{
$text_color = imagecolorallocate($im, 0, 0, 0);
}
imagefilledrectangle($im, 1, 1, $max_width, ($height-2), $background);
imageline($im, 0, 1, 0, ($height-2), $outline);
imageline($im, 1, 0, $max_width, 0, $outline);
imageline($im, ($max_width+1), 1, ($max_width+1), ($height-2), $outline);
imageline($im, 1, ($height-1), $max_width, ($height-1), $outline);
imageline($im, 2, 1, ($max_width-1), 1, $hilite);
imageline($im, $max_width, 2, $max_width, ($height-3), $hilite);
imageline($im, 1, 1, 1, ($height-3), $shadow);
imageline($im, 2, ($height-2), $max_width, ($height-2), $shadow);
// Position the text
$line_width = imagettfbbox($font_size, 0, $font_file, $text);
$horz_pos = (($max_width - $line_width[2] - $line_width[0]) / 2);
// Write the text to the image
imagettftext($im, $font_size, $angle, $x_start, $y_start, $text_color, $font_file, $double_text);
// Display and destroy the image
header("Content-type:image/png");
imagepng($im);
imagedestroy($im);
?>
%%
----
CategoryUserContributions
Deletions:
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size


Revision [17452]

Edited on 2007-09-01 13:08:01 by DecOdx [reverted]
Additions:
====Banner Generator====

The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
%%(php)
<?php
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size
Deletions:
====Banner Generator====

The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
%%(php)
<?php
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size & font.
* USE: {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, blacktext, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
* @author GmBowen (http://wikka.jsnx.com/GmBowen) (with help from JavaWoman), licensed under GPL
*
* REQUIRES GD2 on the server
*
* TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
*/

// set up variables
$site_base = $this->GetConfigValue("base_url");

// Below line might need to be modified to whatever is appropriate for your installation .... 'wikka.php?wakka='
if ( substr_count($site_base, 'wakka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$generator = $site_base."actions/bannergenerator.php?";
$buttoncolor = $bgcolor;

// Set below fonts to those present in fonts directory (which the admin makes in the actions directory)
// Set the first font to that which you wish to be your default if a font isn't specified
// The administrator can add as many different fonts as they wish
if(!$font) {$font = "1";}
if ($font == "1"){$font = "verdana.ttf";}
if ($font == "2"){$font = "toby.ttf";}
if ($font == "3"){$font = "times.ttf";}
if ($font == "4"){$font = "vera.ttf";}
if ($font == "5"){$font = "oldeng.ttf";}
if ($font == "6"){$font = "courierbld.ttf";}

// create img tag
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
?>
%%

This file is REQUIRED in a directory called ##scripts## in the wikka root as ##bannergenerator.php##
%%(php)
<?
// Adapted from a script provided at http://www.geek247.net/ and originally written by
// William Magliano. Modified by GMBowen 2005 for inclusion in Wikka Wiki &
// functionality increased. Released under GPL.
// Script REQUIRES GD2 on the server

$font_file = "./fonts/$font_file";
$defaultFontSize = 12;

if(!$font_size)// If no font size has been passed default to 12pt.
{
$font_size = $defaultFontSize;
}

$angle = 0;

$defaultbgColor = "blue";
$defaulttxtColor = "black";

if(!$buttoncolor)//If no button color is passed make it Blue.
{
$buttoncolor = $defaultbgColor;
}

if(!$textcolor)//If no text color is passed make it Black.
{
$textcolor = $defaulttxtColor;
}

//$textcolor= "red";

$y_start = $font_size*1.5;
$x_start = 5;
$double_text = $text;
$height = $font_size*2;

$bounding_box = imagettfbbox($font_size, 0, $font_file, $text);
$max_width = $bounding_box[2] - $bounding_box[0]+12;

// Create image and allocate colors
$im = imagecreate(($max_width+2), /*15*/$height);
$matte = imagecolorallocate($im, 153, 153, 153);

// allocate code for colors for background
if($buttoncolor == "blue")
{
$outline = imagecolorallocate($im, 0, 105, 179);// dark
$shadow = imagecolorallocate($im, 113, 196, 240);// light
$background = imagecolorallocate($im, 153, 176, 200);//lighter - brighter
$hilite = imagecolorallocate($im, 240, 243, 247);//lightest

}
if($buttoncolor == "red")
{
$outline = imagecolorallocate($im, 255,0,0);// dark
$shadow = imagecolorallocate($im,255,51,51);// light
$background = imagecolorallocate($im, 255,102,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,204);//lightest
}
if($buttoncolor == "purple")
{
$outline = imagecolorallocate($im, 255,0,255);// dark
$shadow = imagecolorallocate($im,255,51,255);// light
$background = imagecolorallocate($im, 255,102,255);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,255);//lightest
}
if($buttoncolor == "yellow")
{
$outline = imagecolorallocate($im, 153,153,51);// dark
$shadow = imagecolorallocate($im,204,204,102);// light
$background = imagecolorallocate($im,255,255,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,204);//lightest
}
if($buttoncolor == "green")
{
$outline = imagecolorallocate($im, 0,153,0);// dark
$shadow = imagecolorallocate($im,0,204,0);// light
$background = imagecolorallocate($im,102,204,102);//lighter - brighter
$hilite = imagecolorallocate($im, 204,255,204);//lightest
}
if($buttoncolor == "grey")
{
$outline = imagecolorallocate($im, 102,102,102);// dark
$shadow = imagecolorallocate($im,153,153,153);// light
$background = imagecolorallocate($im,204,204,204);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,255);//lightest
}

if($buttoncolor == "white")
{
$outline = imagecolorallocate($im, 255,255,255);// white
$shadow = imagecolorallocate($im,255,255,255);// white
$background = imagecolorallocate($im,255,255,255);// white
$hilite = imagecolorallocate($im, 255,255,255);// white
}

if($buttoncolor == "black")
{
$outline = imagecolorallocate($im, 0,0,0);// black
$shadow = imagecolorallocate($im,0,0,0);// black
$background = imagecolorallocate($im,0,0,0);// black
$hilite = imagecolorallocate($im, 0,0,0);// black
}

// allocate code for colors for the text
if($textcolor == "blue")
{
$text_color = imagecolorallocate($im, 153, 176, 200);
}
if($textcolor == "red")
{
$text_color = imagecolorallocate($im, 255, 102, 102);
}
if($textcolor == "purple")
{
$text_color = imagecolorallocate($im, 255, 102, 255);
}
if($textcolor == "yellow")
{
$text_color = imagecolorallocate($im, 255, 255, 102);
}
if($textcolor == "green")
{
$text_color = imagecolorallocate($im, 102, 204, 102);
}
if($textcolor == "grey")
{
$text_color = imagecolorallocate($im, 204, 204, 204);
}

if($textcolor == "white")
{
$text_color = imagecolorallocate($im, 255, 255, 255);
}

if($textcolor == "black")
{
$text_color = imagecolorallocate($im, 0, 0, 0);
}

imagefilledrectangle($im, 1, 1, $max_width, ($height-2), $background);
imageline($im, 0, 1, 0, ($height-2), $outline);
imageline($im, 1, 0, $max_width, 0, $outline);
imageline($im, ($max_width+1), 1, ($max_width+1), ($height-2), $outline);
imageline($im, 1, ($height-1), $max_width, ($height-1), $outline);
imageline($im, 2, 1, ($max_width-1), 1, $hilite);
imageline($im, $max_width, 2, $max_width, ($height-3), $hilite);
imageline($im, 1, 1, 1, ($height-3), $shadow);
imageline($im, 2, ($height-2), $max_width, ($height-2), $shadow);

// Position the text
$line_width = imagettfbbox($font_size, 0, $font_file, $text);
$horz_pos = (($max_width - $line_width[2] - $line_width[0]) / 2);

// Write the text to the image
imagettftext($im, $font_size, $angle, $x_start, $y_start, $text_color, $font_file, $double_text);

// Display and destroy the image
header("Content-type:image/png");
imagepng($im);
imagedestroy($im);
?>
%%

----
CategoryUserContributions


Revision [16862]

Edited on 2007-05-31 23:26:40 by NilsLindenberg [Reverted]
Additions:
====Banner Generator====

The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
%%(php)
<?php
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size & font.
* USE: {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, blacktext, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
* @author GmBowen (http://wikka.jsnx.com/GmBowen) (with help from JavaWoman), licensed under GPL
*
* REQUIRES GD2 on the server
*
* TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
*/

// set up variables
$site_base = $this->GetConfigValue("base_url");

// Below line might need to be modified to whatever is appropriate for your installation .... 'wikka.php?wakka='
if ( substr_count($site_base, 'wakka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$generator = $site_base."actions/bannergenerator.php?";
$buttoncolor = $bgcolor;

// Set below fonts to those present in fonts directory (which the admin makes in the actions directory)
// Set the first font to that which you wish to be your default if a font isn't specified
// The administrator can add as many different fonts as they wish
if(!$font) {$font = "1";}
if ($font == "1"){$font = "verdana.ttf";}
if ($font == "2"){$font = "toby.ttf";}
if ($font == "3"){$font = "times.ttf";}
if ($font == "4"){$font = "vera.ttf";}
if ($font == "5"){$font = "oldeng.ttf";}
if ($font == "6"){$font = "courierbld.ttf";}

// create img tag
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
?>
%%

This file is REQUIRED in a directory called ##scripts## in the wikka root as ##bannergenerator.php##
%%(php)
<?
// Adapted from a script provided at http://www.geek247.net/ and originally written by
// William Magliano. Modified by GMBowen 2005 for inclusion in Wikka Wiki &
// functionality increased. Released under GPL.
// Script REQUIRES GD2 on the server

$font_file = "./fonts/$font_file";
$defaultFontSize = 12;

if(!$font_size)// If no font size has been passed default to 12pt.
{
$font_size = $defaultFontSize;
}

$angle = 0;

$defaultbgColor = "blue";
$defaulttxtColor = "black";

if(!$buttoncolor)//If no button color is passed make it Blue.
{
$buttoncolor = $defaultbgColor;
}

if(!$textcolor)//If no text color is passed make it Black.
{
$textcolor = $defaulttxtColor;
}

//$textcolor= "red";

$y_start = $font_size*1.5;
$x_start = 5;
$double_text = $text;
$height = $font_size*2;

$bounding_box = imagettfbbox($font_size, 0, $font_file, $text);
$max_width = $bounding_box[2] - $bounding_box[0]+12;

// Create image and allocate colors
$im = imagecreate(($max_width+2), /*15*/$height);
$matte = imagecolorallocate($im, 153, 153, 153);

// allocate code for colors for background
if($buttoncolor == "blue")
{
$outline = imagecolorallocate($im, 0, 105, 179);// dark
$shadow = imagecolorallocate($im, 113, 196, 240);// light
$background = imagecolorallocate($im, 153, 176, 200);//lighter - brighter
$hilite = imagecolorallocate($im, 240, 243, 247);//lightest

}
if($buttoncolor == "red")
{
$outline = imagecolorallocate($im, 255,0,0);// dark
$shadow = imagecolorallocate($im,255,51,51);// light
$background = imagecolorallocate($im, 255,102,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,204);//lightest
}
if($buttoncolor == "purple")
{
$outline = imagecolorallocate($im, 255,0,255);// dark
$shadow = imagecolorallocate($im,255,51,255);// light
$background = imagecolorallocate($im, 255,102,255);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,255);//lightest
}
if($buttoncolor == "yellow")
{
$outline = imagecolorallocate($im, 153,153,51);// dark
$shadow = imagecolorallocate($im,204,204,102);// light
$background = imagecolorallocate($im,255,255,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,204);//lightest
}
if($buttoncolor == "green")
{
$outline = imagecolorallocate($im, 0,153,0);// dark
$shadow = imagecolorallocate($im,0,204,0);// light
$background = imagecolorallocate($im,102,204,102);//lighter - brighter
$hilite = imagecolorallocate($im, 204,255,204);//lightest
}
if($buttoncolor == "grey")
{
$outline = imagecolorallocate($im, 102,102,102);// dark
$shadow = imagecolorallocate($im,153,153,153);// light
$background = imagecolorallocate($im,204,204,204);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,255);//lightest
}

if($buttoncolor == "white")
{
$outline = imagecolorallocate($im, 255,255,255);// white
$shadow = imagecolorallocate($im,255,255,255);// white
$background = imagecolorallocate($im,255,255,255);// white
$hilite = imagecolorallocate($im, 255,255,255);// white
}

if($buttoncolor == "black")
{
$outline = imagecolorallocate($im, 0,0,0);// black
$shadow = imagecolorallocate($im,0,0,0);// black
$background = imagecolorallocate($im,0,0,0);// black
$hilite = imagecolorallocate($im, 0,0,0);// black
}

// allocate code for colors for the text
if($textcolor == "blue")
{
$text_color = imagecolorallocate($im, 153, 176, 200);
}
if($textcolor == "red")
{
$text_color = imagecolorallocate($im, 255, 102, 102);
}
if($textcolor == "purple")
{
$text_color = imagecolorallocate($im, 255, 102, 255);
}
if($textcolor == "yellow")
{
$text_color = imagecolorallocate($im, 255, 255, 102);
}
if($textcolor == "green")
{
$text_color = imagecolorallocate($im, 102, 204, 102);
}
if($textcolor == "grey")
{
$text_color = imagecolorallocate($im, 204, 204, 204);
}

if($textcolor == "white")
{
$text_color = imagecolorallocate($im, 255, 255, 255);
}

if($textcolor == "black")
{
$text_color = imagecolorallocate($im, 0, 0, 0);
}

imagefilledrectangle($im, 1, 1, $max_width, ($height-2), $background);
imageline($im, 0, 1, 0, ($height-2), $outline);
imageline($im, 1, 0, $max_width, 0, $outline);
imageline($im, ($max_width+1), 1, ($max_width+1), ($height-2), $outline);
imageline($im, 1, ($height-1), $max_width, ($height-1), $outline);
imageline($im, 2, 1, ($max_width-1), 1, $hilite);
imageline($im, $max_width, 2, $max_width, ($height-3), $hilite);
imageline($im, 1, 1, 1, ($height-3), $shadow);
imageline($im, 2, ($height-2), $max_width, ($height-2), $shadow);

// Position the text
$line_width = imagettfbbox($font_size, 0, $font_file, $text);
$horz_pos = (($max_width - $line_width[2] - $line_width[0]) / 2);

// Write the text to the image
imagettftext($im, $font_size, $angle, $x_start, $y_start, $text_color, $font_file, $double_text);

// Display and destroy the image
header("Content-type:image/png");
imagepng($im);
imagedestroy($im);
?>
%%

----
CategoryUserContributions
Deletions:
====Banner Generator====

The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
%%(php)
<?php
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size


Revision [16660]

Edited on 2007-05-31 10:31:08 by DecOdx [Reverted]
Additions:
====Banner Generator====

The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
%%(php)
<?php
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size
Deletions:
====Banner Generator====

The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
%%(php)
<?php
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size & font.
* USE: {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, blacktext, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
* @author GmBowen (http://wikka.jsnx.com/GmBowen) (with help from JavaWoman), licensed under GPL
*
* REQUIRES GD2 on the server
*
* TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
*/

// set up variables
$site_base = $this->GetConfigValue("base_url");

// Below line might need to be modified to whatever is appropriate for your installation .... 'wikka.php?wakka='
if ( substr_count($site_base, 'wakka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$generator = $site_base."actions/bannergenerator.php?";
$buttoncolor = $bgcolor;

// Set below fonts to those present in fonts directory (which the admin makes in the actions directory)
// Set the first font to that which you wish to be your default if a font isn't specified
// The administrator can add as many different fonts as they wish
if(!$font) {$font = "1";}
if ($font == "1"){$font = "verdana.ttf";}
if ($font == "2"){$font = "toby.ttf";}
if ($font == "3"){$font = "times.ttf";}
if ($font == "4"){$font = "vera.ttf";}
if ($font == "5"){$font = "oldeng.ttf";}
if ($font == "6"){$font = "courierbld.ttf";}

// create img tag
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
?>
%%

This file is REQUIRED in a directory called ##scripts## in the wikka root as ##bannergenerator.php##
%%(php)
<?
// Adapted from a script provided at http://www.geek247.net/ and originally written by
// William Magliano. Modified by GMBowen 2005 for inclusion in Wikka Wiki &
// functionality increased. Released under GPL.
// Script REQUIRES GD2 on the server

$font_file = "./fonts/$font_file";
$defaultFontSize = 12;

if(!$font_size)// If no font size has been passed default to 12pt.
{
$font_size = $defaultFontSize;
}

$angle = 0;

$defaultbgColor = "blue";
$defaulttxtColor = "black";

if(!$buttoncolor)//If no button color is passed make it Blue.
{
$buttoncolor = $defaultbgColor;
}

if(!$textcolor)//If no text color is passed make it Black.
{
$textcolor = $defaulttxtColor;
}

//$textcolor= "red";

$y_start = $font_size*1.5;
$x_start = 5;
$double_text = $text;
$height = $font_size*2;

$bounding_box = imagettfbbox($font_size, 0, $font_file, $text);
$max_width = $bounding_box[2] - $bounding_box[0]+12;

// Create image and allocate colors
$im = imagecreate(($max_width+2), /*15*/$height);
$matte = imagecolorallocate($im, 153, 153, 153);

// allocate code for colors for background
if($buttoncolor == "blue")
{
$outline = imagecolorallocate($im, 0, 105, 179);// dark
$shadow = imagecolorallocate($im, 113, 196, 240);// light
$background = imagecolorallocate($im, 153, 176, 200);//lighter - brighter
$hilite = imagecolorallocate($im, 240, 243, 247);//lightest

}
if($buttoncolor == "red")
{
$outline = imagecolorallocate($im, 255,0,0);// dark
$shadow = imagecolorallocate($im,255,51,51);// light
$background = imagecolorallocate($im, 255,102,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,204);//lightest
}
if($buttoncolor == "purple")
{
$outline = imagecolorallocate($im, 255,0,255);// dark
$shadow = imagecolorallocate($im,255,51,255);// light
$background = imagecolorallocate($im, 255,102,255);//lighter - brighter
$hilite = imagecolorallocate($im, 255,204,255);//lightest
}
if($buttoncolor == "yellow")
{
$outline = imagecolorallocate($im, 153,153,51);// dark
$shadow = imagecolorallocate($im,204,204,102);// light
$background = imagecolorallocate($im,255,255,102);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,204);//lightest
}
if($buttoncolor == "green")
{
$outline = imagecolorallocate($im, 0,153,0);// dark
$shadow = imagecolorallocate($im,0,204,0);// light
$background = imagecolorallocate($im,102,204,102);//lighter - brighter
$hilite = imagecolorallocate($im, 204,255,204);//lightest
}
if($buttoncolor == "grey")
{
$outline = imagecolorallocate($im, 102,102,102);// dark
$shadow = imagecolorallocate($im,153,153,153);// light
$background = imagecolorallocate($im,204,204,204);//lighter - brighter
$hilite = imagecolorallocate($im, 255,255,255);//lightest
}

if($buttoncolor == "white")
{
$outline = imagecolorallocate($im, 255,255,255);// white
$shadow = imagecolorallocate($im,255,255,255);// white
$background = imagecolorallocate($im,255,255,255);// white
$hilite = imagecolorallocate($im, 255,255,255);// white
}

if($buttoncolor == "black")
{
$outline = imagecolorallocate($im, 0,0,0);// black
$shadow = imagecolorallocate($im,0,0,0);// black
$background = imagecolorallocate($im,0,0,0);// black
$hilite = imagecolorallocate($im, 0,0,0);// black
}

// allocate code for colors for the text
if($textcolor == "blue")
{
$text_color = imagecolorallocate($im, 153, 176, 200);
}
if($textcolor == "red")
{
$text_color = imagecolorallocate($im, 255, 102, 102);
}
if($textcolor == "purple")
{
$text_color = imagecolorallocate($im, 255, 102, 255);
}
if($textcolor == "yellow")
{
$text_color = imagecolorallocate($im, 255, 255, 102);
}
if($textcolor == "green")
{
$text_color = imagecolorallocate($im, 102, 204, 102);
}
if($textcolor == "grey")
{
$text_color = imagecolorallocate($im, 204, 204, 204);
}

if($textcolor == "white")
{
$text_color = imagecolorallocate($im, 255, 255, 255);
}

if($textcolor == "black")
{
$text_color = imagecolorallocate($im, 0, 0, 0);
}

imagefilledrectangle($im, 1, 1, $max_width, ($height-2), $background);
imageline($im, 0, 1, 0, ($height-2), $outline);
imageline($im, 1, 0, $max_width, 0, $outline);
imageline($im, ($max_width+1), 1, ($max_width+1), ($height-2), $outline);
imageline($im, 1, ($height-1), $max_width, ($height-1), $outline);
imageline($im, 2, 1, ($max_width-1), 1, $hilite);
imageline($im, $max_width, 2, $max_width, ($height-3), $hilite);
imageline($im, 1, 1, 1, ($height-3), $shadow);
imageline($im, 2, ($height-2), $max_width, ($height-2), $shadow);

// Position the text
$line_width = imagettfbbox($font_size, 0, $font_file, $text);
$horz_pos = (($max_width - $line_width[2] - $line_width[0]) / 2);

// Write the text to the image
imagettftext($im, $font_size, $angle, $x_start, $y_start, $text_color, $font_file, $double_text);

// Display and destroy the image
header("Content-type:image/png");
imagepng($im);
imagedestroy($im);
?>
%%

----
CategoryUserContributions


Revision [4734]

Edited on 2005-01-17 14:32:43 by NilsLindenberg [cat. changed]
Additions:
----
CategoryUserContributions
Deletions:
%%


Revision [4272]

Edited on 2005-01-08 22:06:05 by GmBowen [minor update of banner.php code]
Additions:
/**
* banner.php Version 1.1 - January 7, 2005
* PURPOSE: With this action a banner can be generated with set-able size, background color, font size & font.
* USE: {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, blacktext, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
* @author GmBowen (http://wikka.jsnx.com/GmBowen) (with help from JavaWoman), licensed under GPL
*
* REQUIRES GD2 on the server
*
* TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
*/
// Below line might need to be modified to whatever is appropriate for your installation .... 'wikka.php?wakka='
$generator = $site_base."actions/bannergenerator.php?";
$buttoncolor = $bgcolor;
// Set below fonts to those present in fonts directory (which the admin makes in the actions directory)
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
This file is REQUIRED in a directory called ##scripts## in the wikka root as ##bannergenerator.php##
Deletions:
// action to call bannermaker.php to generate banners ...bannermaker REQUIRES GD2 on the server
// code written by GMBowen (with some help from JavaWoman) for wikka wiki. Version 1b
// licensed under GPL
// Use is {{banner text="Sample Text" [color="blue"] [size="20"] [font = "1"]}}
// Parameters in square brackets are optional....defaults to blue, 8 point, verdana
// Available colors are blue, red, purple, yellow, green, grey, white
// TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in a
// directory called scripts placed in the wikka root
$generator = $site_base."scripts/bannergenerator.php?";
$buttoncolor = $color;
// Set below fonts to those present in fonts directory (which the admin makes in the scripts directory in the wikka root)
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
This file is also required in a directory called ##scripts## in the wikka root as ##bannergenerator.php##


Revision [3989]

Edited on 2005-01-05 00:51:13 by GmBowen [minor script update to address JW's comments (below)]
Additions:
// TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in a
// directory called scripts placed in the wikka root
Deletions:
// TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory


Revision [3988]

Edited on 2005-01-05 00:49:45 by GmBowen [minor script update to address JW's comments (below)]
Additions:
The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in a directory called ##scripts## in the wikka root). On my server with 6 installed fonts it provides the following output.....
// action to call bannermaker.php to generate banners ...bannermaker REQUIRES GD2 on the server
// code written by GMBowen (with some help from JavaWoman) for wikka wiki. Version 1b
// licensed under GPL
// Use is {{banner text="Sample Text" [color="blue"] [size="20"] [font = "1"]}}
// Parameters in square brackets are optional....defaults to blue, 8 point, verdana
// Available colors are blue, red, purple, yellow, green, grey, white
// TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
if ( substr_count($site_base, 'wakka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$generator = $site_base."scripts/bannergenerator.php?";
$buttoncolor = $color;
// Set below fonts to those present in fonts directory (which the admin makes in the scripts directory in the wikka root)
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
This file is also required in a directory called ##scripts## in the wikka root as ##bannergenerator.php##
Deletions:
The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in the actions directory). On my server with 6 installed fonts it provides the following output.....
/**
* Outputs a Banner...to enhance page look & layout.
*
* With this action a banner can be generated with set-able size, background color, font size & font.
*
* Requires GD2 on the server
* @author GmBowen (http://wikka.jsnx.com/GmBowen) (with help from JavaWoman), licensed under GPL
* Use is {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, black text, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
* TTF Fonts must be obtained & uploaded by administrator & placed in a directory "fonts" in the actions directory
*/
// Below line might need to be modified to whatever is appropriate for your installation .... 'wikka.php?wakka='
if ( substr_count($site_base, 'wikka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$generator = $site_base."actions/bannergenerator.php?";
$buttoncolor = $bgcolor;
// Set below fonts to those present in fonts directory (which the admin makes in the actions directory)
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
This file is also required in ##actions## directory as ##bannergenerator.php##


Revision [3921]

Edited on 2005-01-03 14:43:43 by GmBowen [typo fixed, modified code so text color can be set]
Additions:
// William Magliano. Modified by GMBowen 2005 for inclusion in Wikka Wiki &
// functionality increased. Released under GPL.
if(!$buttoncolor)//If no button color is passed make it Blue.
if(!$textcolor)//If no text color is passed make it Black.
Deletions:
// Version 2 - added code for setting text color
// William Magliano. Modified by GMBowen 2005 for inclusion in Wikka Wiki. Released under GPL.
if(!$buttoncolor)//If no Button color is passed make it Blue.
if(!$textcolor)//If no Button color is passed make it Blue.


Revision [3920]

Edited on 2005-01-03 14:25:27 by GmBowen [modified code so text color can be set]
Additions:
====Banner Generator====
* Use is {{banner text="Sample Text" [bgcolor="blue"] [textcolor="red"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue background, black text, 12 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white, black
if ( substr_count($site_base, 'wikka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$buttoncolor = $bgcolor;
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&textcolor='.$textcolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
// Version 2 - added code for setting text color
if(!$font_size)// If no font size has been passed default to 12pt.
$defaultbgColor = "blue";
$defaulttxtColor = "black";
$buttoncolor = $defaultbgColor;
if(!$textcolor)//If no Button color is passed make it Blue.
$textcolor = $defaulttxtColor;
//$textcolor= "red";
// allocate code for colors for background
$outline = imagecolorallocate($im, 255,255,255);// white
$shadow = imagecolorallocate($im,255,255,255);// white
$background = imagecolorallocate($im,255,255,255);// white
$hilite = imagecolorallocate($im, 255,255,255);// white
if($buttoncolor == "black")
$outline = imagecolorallocate($im, 0,0,0);// black
$shadow = imagecolorallocate($im,0,0,0);// black
$background = imagecolorallocate($im,0,0,0);// black
$hilite = imagecolorallocate($im, 0,0,0);// black
// allocate code for colors for the text
if($textcolor == "blue")
$text_color = imagecolorallocate($im, 153, 176, 200);
if($textcolor == "red")
$text_color = imagecolorallocate($im, 255, 102, 102);
if($textcolor == "purple")
$text_color = imagecolorallocate($im, 255, 102, 255);
if($textcolor == "yellow")
$text_color = imagecolorallocate($im, 255, 255, 102);
if($textcolor == "green")
$text_color = imagecolorallocate($im, 102, 204, 102);
if($textcolor == "grey")
$text_color = imagecolorallocate($im, 204, 204, 204);
if($textcolor == "white")
$text_color = imagecolorallocate($im, 255, 255, 255);
if($textcolor == "black")
$text_color = imagecolorallocate($im, 0, 0, 0);
Deletions:
===Banner Generator===
* Use is {{banner text="Sample Text" [color="blue"] [size="20"] [font = "1"]}}
* Parameters in square brackets are optional....defaults to blue, 8 point, verdana
* Available colors are blue, red, purple, yellow, green, grey, white
if ( substr_count($site_base, 'wakka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
$buttoncolor = $color;
echo '<img src="'.$generator.'buttoncolor='.$buttoncolor.'&font_size='.$size.'&font_file='.$font.'&text='.$text.'" alt="'.$text.'" border="0" />';
if(!$font_size)// If no font size has been passed default to 8pt.
$defaultColor = "blue";
$buttoncolor = $defaultColor;
$outline = imagecolorallocate($im, 255,255,255);// dark
$shadow = imagecolorallocate($im,255,255,255);// light
$background = imagecolorallocate($im,255,255,255);//lighter - brighter
$text_color = imagecolorallocate($im, 0, 0, 0);


Revision [3908]

Edited on 2005-01-03 01:44:42 by GmBowen [provided screenshot of bannermaker]
Additions:
The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in the actions directory). On my server with 6 installed fonts it provides the following output.....
http://gmbowen.educ.unb.ca/wikitest/bannermaker.jpg
Place this code in the ##actions## directory as ##banner.php##
Deletions:
The following action can be used generate colored banners on wiki pages by using GD (required on the server) and fonts provided by the administrator. (TTF fonts must me placed in a directory "fonts" in the actions directory) See an example of it [[http://131.202.167.33/helpwiki/wikka.php?wakka=BannerGenerator here]].
place in ##actions## directory as ##banner.php##


Revision [3877]

The oldest known version of this page was created on 2005-01-02 16:20:15 by GmBowen [provided screenshot of bannermaker]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki