Image captions

Author Message

Bill Rust

Tuesday 08 May 2007 5:54:14 am

I've had a trawl through these postings without much luck in solving this small problem.

I'm using eZ 3.4.4 and want to add picture captions underneath images. At the moment I only have the caption text appear when a user hovers over the image, which is ok but I would prefer it to be visible when I upload the file using the "Local image file for upload." Any pointers?

thanks.

Betsy Gamrat

Tuesday 08 May 2007 7:20:38 pm

Bill,

You should be able to edit the datatype override for the images (content/datatype/view/ezimage.tpl) and add the caption underneath, with something similar to:

{$node.data_map.image.content.caption}

Good luck.

Bill Rust

Wednesday 09 May 2007 7:40:16 am

Many thanks for your help Betsy. I had a go at what you suggested but, perhaps being a bit of a eZ newbie, I think I'm missing something.

A little more information, I created a XML text field in the administrator side and called it caption. Now when I create articles there is a field for the caption. In the ezimage.tpl, underneath the below code I tried yours.

  {section show=$href}<a href={$href} {section show=$target}target={$target}{/section}>{/section}<img src={$image.url|ezroot} width="{$image.width}" height="{$image.height}" {section show=$hspace}hspace="{$hspace}"{/section} border="{$border_size}" alt="{$image.text|wash(xhtml)}" title="{$image.text|wash(xhtml)}" />{section show=$href}</a>{/section}

I also tried:

<div class="attribute-caption" style="width: {$object.data_map.image.content[$object_parameters.size].width}px">
        {attribute_view_gui attribute=$object.data_map.caption}
    </div>

as in the embedded images the captions work and this second piece of code is from there. However, it still doesn't work. Any idea of where I'm going wrong?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.