Images

Images can be used in SiteFusion in a few distinct ways. The default behavior for any interface element that offers a src(), image() or other method to set an image URL, will accept the following kinds of strings:
  • "/app/myniceapp/images/someimage.png"
    This type of string (a path with a leading slash) will be interpreted as a server filesystem path relative to the SiteFusion installation directory. This allows you to place images in your application directory and refer to them easily.
  • "http://www.somedomain.com/image.png"
    Regular URLs with http/https protocols.

If you want to use an image that is not stored under the SiteFusion installation directory, use the XULFileSystemImage class. This class will accept any server path, but is slightly less efficient performance-wise because it uses the daemon file transfer path.

Dynamically generated images with GD

SiteFusion allows the displaying of a GD image resource on the client through the XULDirectImage class.

<?php

$image 
imagecreate(300300);
$dark_grey imagecolorallocate($image102102102);
$white imagecolorallocate($image255255255);
imagettftext($image50, -453070$white'advent_light''Hello World!');
 
$directImage = new XULDirectImage(300300);
$this->window->addChild($directImage);

$directImage->setImageType('png');
$directImage->cacheStream($image);
$directImage->recycle();