2017-10-16 74 views
1

我重寫cropVariants用於圖像處理是這樣的:TYPO3 - 渲染爲響應圖像裁剪選項TYPO3 8.7流體

https://docs.typo3.org/typo3cms/extensions/core/8.7/Changelog/8.7/Feature-79812-AllowOverridingCropVariantsForImageManipulation.html

但我怎麼能取決於流體具體cropVariant渲染的第一個形象呢?假設@media爲'mobile'(max-width:575px){} ...?

調試模板顯示了第一個「創建新的關係」的媒體文件(jpg圖片)作物如下:

<f:debug>{data}</f:debug> 

array(85 items) 
... 
    media => array(1 item) 
     0 => TYPO3\CMS\Core\Resource\FileReferenceprototypeobject 
     propertiesOfFileReference => protectedarray(35 items) 
      ... 
      crop => '{"desktop":{"cropArea":{"x":0.011,"y":0,"width":0.924,"height":0.99047619047 
       619},"selectedRatio":"NaN","focusArea":null},"mobile":{"cropArea":{"x":0.094,"y":1.917337540 
       94e-15,"width":0.786,"height":0.99809523809524},"selectedRatio":"3:2","focus 
       Area":null}}' (392 chars) 
... 

回答

1
<f:image 
    src="{image.0.uid}" 
    treatIdAsReference="1" 
    width="1140" 
    height="375" 
    cropVariant="desktop" 
/> 
+0

Dokumentation:https://docs.typo3.org/typo3 CMS/ExtbaseGuide /液/視圖助手/ Image.html#cropvariant –