【发布时间】:2018-03-07 21:08:43
【问题描述】:
我想在图像处理器 (ImageVariations) 缩放/裁剪之后检索 magnolia 中图像的高度和宽度,但我似乎没有找到正确的方法。
这是我在 theme.yaml 中所做的一个定义:
imaging:
class: info.magnolia.templating.imaging.VariationAwareImagingSupport
variations:
"large":
class: info.magnolia.templating.imaging.variation.SimpleResizeVariation
width: 745
[...]
我要做的是:
在我的模板 (FTL) 中,我首先通过写入
[#assign itemKey = content.backgroundImage!""]来获取 JCR 密钥。我正在使用 DamFunctions 通过它的键检索资产
damfn.getAsset(itemKey);我正在使用
dam.getRendition(asset, renditionName)获取再现(我理解为图像的缩放版本)
我可以从 AssetMetaData 中读取宽度和高度,但即使使用 Rendition 对象,我仍然会获得 原始 资产元数据,而不是预期的缩放后的元数据。
我做错了吗?
编辑:你能看看这张照片吗?它显示了我用来检索 maxwidth 和 maxheight 的路径。请告诉我有可能走那条路。
感谢您的帮助!
【问题讨论】:
标签: java freemarker magnolia