Задача: вывести рендомносгенеренную страницу как картинку, адрес картинки будет 
http://example.com/img-page/, в настройке шаблона обязательно указать очистку всего TS-кода (
Очистить:  Constants Setup )
TS
	Код:
	page = PAGE
config{
    disableCharsetHeader = 1
    disableAllHeaderCode = 1
    additionalHeaders = Content-type: image/jpeg
}
includeLibs.getImageContent = fileadmin/templates/userfunc/class.imageHelper.php
page.10 = USER_INT
page.10{
    userFunc = user_imageHelper->getCouponeContent
    gifBuilder{
        file = GIFBUILDER
        file{
            XY = [10.w], [10.h]
            format = jpg
            10 = IMAGE
            10{
                file = fileadmin/user_upload/action/kupon.jpg
            }
            20 = TEXT
            20{
                align = left
                offset = 220, [10.h]-35
                fontColor = #ffffff
                niceText = 1
                fontSize = 26
                fontFile = fileadmin/templates/fonts/tahoma.ttf
            }
        }
    }
}
 
 
	PHP код:
	
		
			
class user_imageHelper{
    function getCouponeContent($content,$conf){
        //PREPOCESSING IMG. CONF
        $conf['gifBuilder.']['file.']['20.']['text'] = rand(100000,999999);
        $filePath = $GLOBALS['TSFE']->cObj->IMG_RESOURCE($conf['gifBuilder.']);
        
        
        //GET FILE CONTENT
        $fp = fopen(PATH_site.$filePath,'r');
        $imgContent = fread($fp, filesize(PATH_site.$filePath));
        fclose($fp);
        
        return $imgContent;
    }
}