HowTo see if article has an image

HowTo see if article has an image

Sunday 10 August 2003 8:29:29 am - 5 replies

Author Message

Selmah Maxim

Sunday 10 August 2003 9:34:40 am

try this :

{section show=is_object($content_version.data_map.thumbnail)}
{attribute_view_gui attribute=$content_version.data_map.thumbnail image_class=medium}
{/section}

John van der Boom

Sunday 10 August 2003 10:59:25 am

Hey Selmah,

I tried this:
{section show=is_object($content_version.data_map.thumbnail)}
{attribute_view_gui attribute=$content_version.data_map.thumbnail image_class=medium}
{section-else}
<img src={"informe.gif"|ezimage} width="190" height="136" />
{/section}

But still it won't work so I tested what the operator "is_object" is returning as value for a new article without an image with:

{default content_version=$node.contentobject_version_object}
{is_object($content_version.data_map.thumbnail)}

and it turned out that the value is 1 (true).
And this should be 0 (false) becasue there is no image attached to the image :(

Bjørn Kaarstein

Sunday 10 August 2003 10:31:08 pm

This one works for me:

{section show=ne($:item.data_map.picture.content)}

<img src={$:item.data_map.picture.content[original].full_path|ezurl} hspace="10" vspace="10" border=0 align=right>

{/section}

I can't really see the logic here, becuse I would assume that the show= should contain eq instead of ne. Anyway, this runs smoothly within a loop.

Regards Bjørn

John van der Boom

Monday 11 August 2003 1:42:31 am

{$:item.data_map.thumbnail.content}

This is not working for me either.

I tried to echo the value for different article (with and without image) and for all of them, the value of content is "null". So the value is not set.

What is happening here?

John van der Boom

Monday 11 August 2003 5:57:54 am

Found the correct code:

{section show=is_object($content_version.data_map.thumbnail.content)}
{attribute_view_gui attribute=$content_version.data_map.thumbnail image_class=medium}
{section-else}
<img src={"standard.gif"|ezimage} width="190" height="136" />
{/section}

As you can see I combined both of your tips and came with this. It's working perfectly.
How can I add this to the documentation?

You must be logged in to post messages in this topic!

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