Reputation: 5132
In a custom extbase extension, we have an image field set up like this:
Model
/**
* Returns the picture
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $picture
*/
public function getPicture()
{
return $this->picture;
}
/**
* Sets the picture
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $picture
* @return void
*/
public function setPicture(\TYPO3\CMS\Extbase\Domain\Model\FileReference $picture)
{
$this->picture = $picture;
}
TCA
'picture' => array(
'exclude' => 0,
'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_address.picture',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'picture',
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'
)
),
'maxitems' => 1
),
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
),
When I try to access the FAL resource in fluid via
<f:image src="{myextitem.picture}" width="600" height="750c"/>
an empty image tag is output.
I can access the original resource with
<f:image src="{myextitem.picture.originalResource.publicUrl}" width="600" height="750c"/>
but that doesn't respect modifications to the image by the crop wizard.
Where shoud I look to make the FAL resource accessible by fluid?
Upvotes: 1
Views: 785
Reputation: 7036
Have a look in the ImageViewHelpers render()
method. The accepted parameter are explained there:
* @param string $src a path to a file, a combined FAL identifier or an uid (int). If $treatIdAsReference is set, the integer is considered the uid of the sys_file_reference record. If you already got a FAL object, consider using the $image parameter instead
* ...
* @param FileInterface|AbstractFileFolder $image a FAL object
So if you use src="{imageResource}"
it won't work because src
expects a string.
Try <f:image image="{imageResource}" width="600" height="750c"/>
instead.
Upvotes: 6