*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A image helper class");
}
/**
*
* @param $templateInstance An instance of a template engine
* @param $imageType Type of the image
- * @return $helperInstance A preparedf instance of this class
+ * @return $helperInstance A preparedf instance of this helper
*/
public final static function createImageHelper (CompileableTemplate $templateInstance, $imageType) {
// Get new instance
public final function setFontSize ($fontSize) {
// Random font size?
if ($fontSize === "rand") {
- $fontSize = $this->getRngInstance()->randomNumber(3, 9);
+ $fontSize = $this->getRngInstance()->randomNumber(4, 9);
} // END - if
$this->imageStrings[$this->currString]['size'] = (int) $fontSize;
$templateInstance->loadCodeTemplate($this->getBaseImage());
// Assign all the image values with the template
- $templateInstance->assignVariable("image_name" , $this->getImageName());
- $templateInstance->assignVariable("image_type" , $this->getImageType());
- $templateInstance->assignVariable("image_width" , $this->getWidth());
- $templateInstance->assignVariable("image_height" , $this->getHeight());
- $templateInstance->assignVariable("image_bg_red" , $this->backgroundColor['red']);
- $templateInstance->assignVariable("image_bg_green", $this->backgroundColor['green']);
- $templateInstance->assignVariable("image_bg_blue" , $this->backgroundColor['blue']);
- $templateInstance->assignVariable("image_fg_red" , $this->foregroundColor['red']);
- $templateInstance->assignVariable("image_fg_green", $this->foregroundColor['green']);
- $templateInstance->assignVariable("image_fg_blue" , $this->foregroundColor['blue']);
+ $templateInstance->assignVariable('image_name' , $this->getImageName());
+ $templateInstance->assignVariable('image_type' , $this->getImageType());
+ $templateInstance->assignVariable('image_width' , $this->getWidth());
+ $templateInstance->assignVariable('image_height' , $this->getHeight());
+ $templateInstance->assignVariable('image_bg_red' , $this->backgroundColor['red']);
+ $templateInstance->assignVariable('image_bg_green', $this->backgroundColor['green']);
+ $templateInstance->assignVariable('image_bg_blue' , $this->backgroundColor['blue']);
+ $templateInstance->assignVariable('image_fg_red' , $this->foregroundColor['red']);
+ $templateInstance->assignVariable('image_fg_green', $this->foregroundColor['green']);
+ $templateInstance->assignVariable('image_fg_blue' , $this->foregroundColor['blue']);
// Add all strings
- foreach ($this->imageStrings as $id=>$imageString) {
- // Set current string id
+ foreach ($this->imageStrings as $id => $imageString) {
+ // Set current string id to keep this helper in sync with template engine
$this->currString = $id;
// Set variable group
$templateInstance->setVariableGroup($id);
// Add group variables
- $templateInstance->addGroupVariable("image_x" , $this->getX());
- $templateInstance->addGroupVariable("image_y" , $this->getY());
- $templateInstance->addGroupVariable("image_size" , $this->getFontSize());
- $templateInstance->addGroupVariable("image_string", $this->getImageString());
+ $templateInstance->addGroupVariable('image_x' , $this->getX());
+ $templateInstance->addGroupVariable('image_y' , $this->getY());
+ $templateInstance->addGroupVariable('image_size' , $this->getFontSize());
+ $templateInstance->addGroupVariable('image_string', $this->getImageString());
} // END - foreach
// Get the raw content
$imageContent = $templateInstance->getRawTemplateData();
// Transfer all to the template engine
- $templateInstance->renderImageContent($imageContent);
+ $templateInstance->renderXmlContent($imageContent);
}
}