Exception_Warning: Declaration of RedSparkFramework_RsModule_Cms_Controller_Asset_IncParsedHtmlFile::getFormArray() should be compatible with that of RedSparkCore_RsModule_Cms_Controller_Asset_ListExtended::getFormArray()
Exception_Model: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c.name' in 'field list'
Try create Table
Exception_Model: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND fk_account = '1' AND enabled IN ('Y', 'M', 'TM', 'T',' at line 23


Image generation and manipulation

This component helps you at tasks like create a images/buttons with dynamic color, dynamic text and/or dynamic width/height. It is also a good helper for easy resizing and delivering images.

Image Generator

The image generator is an abstraction for php-gd images with some operations on it. It does not only support basic features like resizing or moving an image, it also supports adding and subtracting (WiP) of images (layers).

By now it is not possible to use mask-layers. It is planed to implement this via the subLayer() method. The layer will the be substracted from the image, this means, solid parts are cut from the image while transparent parts stay.

Internal structure

By now there are only three conrete and one abstract class. Each concrete class has its own constructor for easier use.

  1. Redspark_RsImage: An abstract image class with methods and attributes working on the image ressource.
  2. Redspark_RsImage_Empty: A simple implementation for creating a new, empty image.
  3. Redspark_RsImage_Text: Allows you to create text with imagemagick.
  4. Redspark_RsImage_File: Load an image directly from a given file.

Working with images


/* Load button image */
$btn = new Redspark_RsImage_File($path_to_button_file);
/* Load some fancy add-on */
$addon = new Redspark_RsImage_File($path_to_addon_file);
/* Scale-up the addon to the size of the button */
/* Lay addon over the button */
/* print the image */
echo $btn->getSource(Redspark_RsImage::TYPE_PNG);


Creating a text image

Text creation is very simple. you can either use the open-source font "Vera", delivered with RedSpark or specify the path to another ttf file.


/* Create text layer */
$txt = new Redspark_RsImage_Text($this->_text$options);

/* Create text layer with red, big text (20px) in my font */
$options = Array(
Redspark_RsImage_Text::INIT_OPTION_FONT_FILE => 'fonts/MyFont.ttf',
Redspark_RsImage_Text::INIT_OPTION_FONT_SIZE => 20,
Redspark_RsImage_Text::INIT_OPTION_FONT_COLOR => Array(255,0,0,0),
$txt = new Redspark_RsImage_Text($this->_text$options);


Overlapping images

If you want to overlap images, you first have to make sure, the underlying image has the right size. Otherwise the layer will be cutted to the size of the background.


/* Create background */
$img = new Redspark_RsImage_File('bg.png');
/* Create layer */
$img2 = new Redspark_RsImage_File('layer1.png');
/* Add the layer to the background */
/* print the image */
echo $btn->getSource(Redspark_RsImage::TYPE_PNG);

  • Implement all croping algorithms.
  • Test crop algorithm in all 3 forms square, wide, high.
  • More error handling (libs not installed, width <=0)
  • subLayer() for transparency masks


Kuborgh GmbH

Hamburg 040 819 773 770 Köln 0221 276 66 96 info@kuborgh.de www.kuborgh.de

RedSpark Community

RedSpark Community

Community Website
RedSpark Apps

RedSpark Apps

Zur Übersicht
RedSpark Download

RedSpark Basispaket

Zum Download
Key facts