rtgx

cObj IMAGE

Funkcia je určená pre pi triedy frontend modulov. Renderuje obrázok podľa nastavení v typoscripte (v príklade TS sa náhľad obrázku otvára v novom okne).

Setup:
plugin.tx_rtgextension_pi1 {
imageMap {
file.maxW = 20
file.maxH = 20
params =
imageLinkWrap = 1
imageLinkWrap {
enable = 1
bodyTag = <body bgcolor="#ffffff">
wrap = <a href="javascript:close();">|</a>
width = 600m
height = 600m
JSwindow = 1
JSwindow.newWindow = 1
JSwindow.expand = 17,20
}
}
}
PHP:
	var $path          = 'uploads/tx_rtgextension/';	// Path to uploaded files

/**
* Create image cObject
*
* @param array $conf: TS configuration
* @param string $imageName - image name :)
* @return string image HTML tag
*/
function getImage( $conf, $imageName ) {

$conf['file'] = $this->path.$imageName;
return $this->local_cObj->IMAGE( $conf );
}

Príklad volania funkcie (výstupkm je HTML tag IMG):

$marks['###IMAGE###'] = $this->getImage( $this->conf['image.'], $item['image'] );

Generovanie zoznamu obrázkov

PHP
	/**
* Create image cObject
*
* @param array $conf: TS configuration
* @param string $imageName: image name :)
* @return string return: image HTML tag
*/
function getImage( $conf, $imageName ) {

$images = explode( ',', $imageName );
if( is_array( $images ) && count( $images ) > 1 ) {
foreach( $images as $image ) {
$conf['file'] = $this->path.$image;
$temp = $this->local_cObj->IMAGE( $conf );
$out .= $temp;
$this->images[] = $this->local_cObj->IMAGE( $conf );
}
return $out;
}
else {
$conf['file'] = $this->path.$imageName;
$temp = $this->local_cObj->IMAGE( $conf );
$this->images[] = $this->local_cObj->IMAGE( $conf );
return $temp;
}
}
 
Žiadne dokumenty ani odkazy k tejto stránke.