我为我的视图类使用了一个DisplayForm,并使用以下命令成功呈现了一个NamedBlobImage字段:
<span tal:replace="structure view/w/image/render" />如何调整ZPT以显示不同图像大小,如“image_mini”或plone.app.imaging中的任何其他图像大小?
发布于 2011-09-08 21:14:35
为此,您应该使用plone.app.imaging。
它将如下所示:
<img tal:define="scales context/@@images;
thumbnail python: scales.scale('image', width=64, height=64);"
tal:condition="thumbnail"
tal:attributes="src thumbnail/url;
width thumbnail/width;
height thumbnail/height" />其中,context是保存图像和图像的对象(在scales.scale(' image '...)上)包含要调整大小的图像的字段名称。
如果您想使用预定义的图像大小,只需使用:
<img tal:define="scale context/@@images"
tal:replace="structure python: scale.scale('image',
scale='mini').tag()" />干杯
发布于 2011-09-08 23:23:22
就像原型图像字段一样,一组预定义的比例在Dexterity中自动可用。要达到这些目的,最方便的捷径是使用如下代码:
<img src=”#” tal:replace=”structure
context/@@images/fieldname/scale” />其中"fieldname“是字段的名称,"scale”是预定义的比例之一。
有关完整信息,请查看http://pypi.python.org/pypi/plone.namedfile/#image-scales。
https://stackoverflow.com/questions/7347118
复制相似问题