Typoscript 自定义内容在模板中获取媒体图像

Typoscript custom content get Media Image in Template

我想要一个只渲染图像的自定义元素。 我已经创建了一个自定义扩展。

这是我得到的:

ext_tables.php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
mod.wizards.newContentElement.wizardItems.common.elements {
    cce_teaser {
        icon = EXT:core/Resources/Public/Icons/T3Icons/content/content-image.svg
        title = Produkt Bild
        description = Hauptbild auf der Produktseite
        tt_content_defValues.CType = product_image
    }
}
mod.wizards.newContentElement.wizardItems.common.show := addToList(cce_teaser)
');

$TCA['tt_content']['columns']['CType']['config']['items'][] =
  array(
    'Custom Content Elements',
    '--div--'
  );

$TCA['tt_content']['columns']['CType']['config']['items'][] =
  array(
    'Hauptbild auf der Produktseite',
    'product_image',
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'ext_icon.gif'
  );

$TCA['tt_content']['types']['product_image']['showitem'] = '
    --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.general;general,
    --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.header;header,
    --div--;Text,
    bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css], rte_enabled;LLL:EXT:cms/locallang_ttc.xml:rte_enabled_formlabel,
    --div--;Bilder,
    image,
    --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
    --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.visibility;visibility,
    --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.access;access,
';

我得到的有效:

Custom Image Element in Backend

2000_product_page.t3s

tt_content.product_image = COA
tt_content.product_image {
  10 = FLUIDTEMPLATE
  10 {
    file = {$resDir}/Private/Templates/ProductDetailImage.html
    partialRootPath = {$resDir}/Private/Partials
    layoutRootPath = {$resDir}/Private/Layouts
  }
}

ProductDetailImage.html

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:ce="http://typo3.org/ns/TYPO3/CMS/FluidStyledContent/ViewHelpers" data-namespace-typo3-fluid="true">
<h1>Test</h1>

<f:debug>{data}</f:debug>
<!-- HOW CAN I GET THE IMAGE INFORMATIONS? SRC, TITLE, WITH, HEIGHT ... -->

</html>

模板 ProductDetailImage.html 已呈现,但我不知道如何获取图像数据。 有人知道我必须做什么吗?请帮忙!

感谢大家的帮助!!!

如果您的图片上传字段使用 FAL 正确配置,从 TYPO3 7.6 开始您可以在 FLUIDTEMPLATE 中使用处理器。要获取图像数据,您可以使用 ViewHelper 或那些处理器。在此处查看 FilesProcessor:https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html