Skip to main content
1 of 2
osh
  • 615
  • 2
  • 7
  • 16

Showing a generic image when no image is chosen

I'm trying to do this:

{% for image in entry.illustration %}
{% if image | length %}
<a href="{{ entry.url }}" class="flag__img">
<img src="{{ image.getUrl }}" alt="{{ entry.altText }}" class="profile__image"></a>
{% else %}  
<p>No image.</p>        
{% endif %}
{% endfor %}

Without any luck. What would be a good way of telling craft to do something else if entry.illustration does not have an image defined?

osh
  • 615
  • 2
  • 7
  • 16