首页 > 解决方案 > Typo3 用本地文件夹路径中的大数据 URL 替换大外部图像的 src

问题描述

Typo3 用本地文件夹路径中的大数据 URL 替换大外部图像的 src。路径:typo3conf/ext/bootstrap_package/Resources/Private/Partials/ContentElements/Media/Rendering/Image.html

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<img src="{f:uri.image(src: 'EXT:bootstrap_package/Resources/Public/Images/blank.gif')}" data-src="{f:uri.image(image: file)}" data-large="{f:uri.image(image: file, cropVariant: 'default', maxWidth: 1140)}" data-medium="{f:uri.image(image: file, cropVariant: 'medium', maxWidth: 940)}" data-small="{f:uri.image(image: file, cropVariant: 'small', maxWidth: 720)}" data-extrasmall="{f:uri.image(image: file, cropVariant: 'extrasmall', maxWidth: 320)}" title="{file.title}" alt="{file.alternative}" class="lazyload" data-preload="{f:if(condition: settings.preload.images, then: 'true', else: 'false')}" />
<noscript>
    <img src="{f:uri.image(image: file)}" title="{file.title}" alt="{file.alternative}" />
</noscript>
</html>  
问题是我们有一个 7 mb 的大文件 1140 X 700 它属于 data-large。我正在为它添加一个外部 URL。但是当我查看页面时,它将 img src 替换为具有本地图像路径而不是外部图像路径的大数据。我正在从扩展名中添加一个外部图像文件。HTML页面看起来像

<img src="/typo3k/fileadmin/_processed_/c/6/csm_Namibia__6__01_bf7ab3fa07.jpg" data-src="https://media.........../view/14fd891e99c67dfc2d475aded2f38d3b389811" data-large="/typo3k/fileadmin/_processed_/c/6/csm_Namibia__6__01_bf7ab3fa07.jpg" data-medium="/typo3k/fileadmin/_processed_/c/6/csm_Namibia__6__01_2ea86b1ad4.jpg" data-small="/typo3k/fileadmin/_processed_/c/6/csm_Namibia__6__01_a5c4bf8281.jpg" data-extrasmall="/typo3k/fileadmin/_processed_/c/6/csm_Namibia__6__01_03571e8240.jpg" title="" alt="" class="lazyload" data-preload="false" style="opacity: 1;">

该问题仅发生在大图像文件中,对于小图像,它的工作正常,显示 src 属性的外部链接和大数据。

对于小型 720 X ...图像其工作在视图中显示 html,例如

<img src="https://media............../view/11ca5ff84cdb906c5427d87bb3bd383e389813" data-src="https://media.............../view/11ca5ff84cdb906c5427d87bb3bd383e389813" data-large="https://.................../view/11ca5ff84cdb906c5427d87bb3bd383e389813" data-medium="https://media................../view/11ca5ff84cdb906c5427d87bb3bd383e389813" data-small="/typo3k/fileadmin/_processed_/5/9/csm_Namibia__6__c0a95f8209.jpg" data-extrasmall="/typo3k/fileadmin/_processed_/5/9/csm_Namibia__6__75677ed405.jpg" title="" alt="" class="lazyload" data-preload="false" style="opacity: 1;">

请帮助我打字3 8.7版本我正在工作。

标签: typo3typo3-8.x

解决方案


尝试这个:

<img
    src="{f:uri.image(src: 'EXT:bootstrap_package/Resources/Public/Images/blank.gif')}"
    data-src="{f:uri.image(image: file, maxHeight:dimensions.height, maxWidth: dimensions.width, treatIdAsReference:1)}"
    data-large="{f:uri.image(image: file,treatIdAsReference:'1', cropVariant: 'default', maxWidth: 1140)}"
    data-medium="{f:uri.image(image: file, treatIdAsReference:'1', cropVariant: 'medium', maxWidth: 940)}"
    data-small="{f:uri.image(image: file, treatIdAsReference:'1', cropVariant: 'small', maxWidth: 720)}"
    data-extrasmall="{f:uri.image(image: file, treatIdAsReference:'1', cropVariant: 'extrasmall', maxWidth: 320)}"
    title="{file.title}" alt="{file.alternative}"
    class="lazyload"
    data-preload="{f:if(condition: settings.preload.images, then: 'true', else: 'false')}"
/>

我添加了treatIdAsReference 参数。你对图像处理有任何限制吗?


推荐阅读