---
title: "TypoScript Objekt anstatt von Strings"
url: "https://www.typo3.net/d/112994-typoscript-objekt-anstatt-von-strings"
source: "typo3.net"
tags: ["TYPO3","TypoScript","Frage"]
created: "2012-11-30"
last_reply: "2012-11-30"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# TypoScript Objekt anstatt von Strings

TYPO3 › TypoScript · 2 Antworten · gestartet 2012-11-30

## Eröffnungsbeitrag

**christianb1** · 2012-11-30 · [Beitrag #1](https://www.typo3.net/d/112994-typoscript-objekt-anstatt-von-strings/1)

Hallo,

ich habe einen Hook gebastelt, der mir bei bedarf noch eine Caption auf das Bild rendert. Soweit sogut.

```php
class tx_dlfunkhaus_tslib_cObj implements tslib_cObj_getImgResourceHook {
	/**
	 * (non-PHPdoc)
	 * @see tslib_cObj_getImgResourceHook::getImgResourcePostProcess()
	 */
	public function getImgResourcePostProcess($file, array $configuration, array $imageResource, tslib_cObj $parent){
		if( $configuration['caption'] ){
			$fileArray = array(
				'XY' => sprintf("%d,%d",$imageResource[0], $imageResource[1]+20),
				'format' => 'png',
				'quality' => '100',
				'backColor' => '#FFFFFF',
				'10' => 'IMAGE',
				'10.' => array("file" => $imageResource[3]),
				'15' => "TEXT",
				'15.' => array(
					"text" => $configuration['caption'],
					"fontColor" => "#000",
					"fontSize" => "12",
					"offset" => sprintf("%d,%d",10,$imageResource[1]+15 ),
				)
			
			);
			/*15 = IMAGE
			15.offset = 420,18
			15.file = fileadmin/overlay.png
			15.mask = fileadmin/mask.png
			#		15.mask = fileadmin/mask_i.png
  			*/
			
			$gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
			/* @var $gifCreator tslib_gifbuilder */
			$gifCreator->init();
			
			$theImage = '';
			if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
				$gifCreator->start($fileArray, $this->data);
				$theImage = $gifCreator->gifBuild();
			}
			$imageResource = $gifCreator->getImageDimensions($theImage);
				
			
		}
		return $imageResource;
	}
	
}
```

So das funktioniert auch alles soweit. Jetzt habe ich versucht TYPO3 beizubringen den Namen aus DAM auszulesen und diesen direkt ins Bild zu rendern. Klappt auch fast...

```typoscript
    ### DAM Meta data ###
    tt_content.image.20.renderMethod = figure
     
     
    tt_content.image.20.1.file.caption = TEXT
    tt_content.image.20.1.file.caption.text.data = field : txdam_copyright
```

Jetzt bekomme ich auf das Bild immer den String "TEXT" gerendert und nicht das Ergebnis der eigentlichen Abfrage. Es wird immer ein String nie das komplette Array in der Konfiguration übergeben.

Ich habe viel gesucht, bin aber auf nichts passendes gestoßen. Vielleicht hat ja jemand eine Idee.

Gruß
Christian

## Antworten

### [#2](https://www.typo3.net/d/112994-typoscript-objekt-anstatt-von-strings/2) · LuP · 2012-11-30

Hallo,

```typoscript
tt_content.image.20.1.file.caption.data = field : txdam_copyright
```

VG,
LuP

### [#3](https://www.typo3.net/d/112994-typoscript-objekt-anstatt-von-strings/3) · christianb1 · 2012-11-30

Hi,

danke für den Hinweis, das hab ich aber auch schon durch. Ich habe mich dabei an dem TypoScript der Extension dam_ttcontent orientiert.

Gruß
Christian

---

Quelle: „TypoScript Objekt anstatt von Strings“, typo3.net, https://www.typo3.net/d/112994-typoscript-objekt-anstatt-von-strings
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
