ビュー クラスに DisplayForm を使用しており、NamedBlobImage フィールドのレンダリングに成功しました。
<span tal:replace="structure view/w/image/render" />
その ZPT を微調整して、「image_mini」や plone.app.imaging の他の画像サイズを表示するにはどうすればよいですか?
Archetypes の画像フィールドと同様に、Dexterity では一連の定義済みスケールが自動的に使用可能になります。これらを取得するための便利なショートカットは、次のようなコードを使用することです。
<img src=”#” tal:replace=”structure
context/@@images/fieldname/scale” />
ここで、「fieldname」はフィールドの名前で、「scale」は定義済みのスケールの 1 つです。
完全な情報については、http://pypi.python.org/pypi/plone.namedfile/#image-scalesをご覧ください。
これには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()" />
乾杯