Das folgende Beispiel bezieht sich auf zwei FAL Felder "image" und "images". Das erste Feld beinhaltet eine FileReference, das zweite dient zur Aufnahme mehrerer FileReferences. Angepasst für TYPO3 Version 7.6 LTS mit Backend Image Cropping Editor.

ext_tables.sql

image int(11) unsigned NOT NULL default '0',
images int(11) unsigned NOT NULL default '0',

TCA Konfiguration

'image' => array(
	'exclude' => 1,
	'label' => 'LLL:EXT:example/Resources/Private/Language/locallang_db.xlf:tx_example_domain_model_test.image',
	'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
		'image',
		array(
			'appearance' => array(
				'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
			),
			'foreign_types' => array(
				'0' => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				)
			),
			'foreign_match_fields' => array(
					'fieldname' => 'image',
					'tablenames' => 'tx_example_domain_model_test',
					'table_local' => 'sys_file',
			),
			'maxitems' => 1,
			'minitems' => 1,
		),
		$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
	),
),

'images' => array(
	'exclude' => 1,
	'label' => 'LLL:EXT:example/Resources/Private/Language/locallang_db.xlf:tx_example_domain_model_test.images',
	'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
		'images',
		array(
			'appearance' => array(
				'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
			),
			'foreign_types' => array(
				'0' => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				),
				\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
					'showitem' => '
					--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
					--palette--;;filePalette'
				)
			),
			'foreign_match_fields' => array(
					'fieldname' => 'images',
					'tablenames' => 'tx_example_domain_model_test',
					'table_local' => 'sys_file',
			),
			'maxitems' => 9,
			'minitems' => 1,
		),
		$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
	),
),

Extbase Model

/**
 * image
 *
 * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
 */
protected $image = NULL;

/**
 * images
 *
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
 */
protected $images = NULL;

/**
 * Returns the image
 *
 * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
 */
public function getImage() {
	return $this->image;
}

/**
 * Sets the image
 *
 * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
 * @return void
 */
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
	$this->image = $image;
}

/**
 * Returns the images
 *
 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Domain\Model\FileReference> $images
 */
public function getImages() {
	return $this->images;
}

/**
 * Sets the images
 *
 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Domain\Model\FileReference> $images
 * @return void
 */
public function setImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $images) {
	$this->images = $images;
}

Fluid Template

<f:image src="{test.image.uid}" alt="" width="" height="" treatIdAsReference="1" />

<f:if condition="{test.images}">
	<f:for each="{test.images}" as="image">
		<f:image src="{image.uid}" alt="" width="" height="" treatIdAsReference="1" />
	</f:for>
</f:if>




Kommentare

Dino schrieb am 21.06.2017:
Danke für Deine Anleitung.
Leider funktioniert das bei mehreren Bildern trotzdem nicht. Ich erhalte einen oops... Fehler, da er kein Array im Fluid Template beim for each Loop als Input erhält.

Irgendwie bekomme ich die Bilder zwar im BE am Plugin angezeigt aber nicht im Fluid Template...

Ich freue mich über Hilfe :))

Flo schrieb am 13.09.2019:
Das gleiche Problem habe ich leider auch :/