Forums / Setup & design / How do I check if an image exist
Clay Pereira
Monday 22 March 2004 11:23:00 am
Hi,I'm trying to check to see if an image exist. If it doesn't I don't want to display the section. This is what I have. Why doen't it work.
{section show=ne($node.object.data_map.image.content)} {attribute_view_gui attribute=$node.object.data_map.image image_class=small alignment=right href=$node.url_alias|ezurl}{/section}
thank you
Trond Åge Kvalø
Monday 22 March 2004 12:44:41 pm
You are using show=ne(($node.object.data_map.image.content)}
Isn't that the same as saying if there's no image, show the image? Or am I missing something essential here. (It's late and I'm dead tired...)
Anyway here's the "official" method of checking if there's an image. Taken from the "New image system" infopage.
{let content=$node.data_map.image.content} {section show=$content.is_valid} We have an image. {section-else} No image has been uploaded. {/section} {/let}
I've used it a lot and it works for me.
best regardstrondåge
trondåge