I have a single asset field that handles two kinds of images:
1) Big Banner image 2) Small featured image
The problem is I want to check for the presence of the second image before I output it on the page. I am doing it like so:
{% if entry.igBanner[1] | length %}
{% set asset = entry.igBanner[1] %}
<img src={{ asset.url }} class="img-responsive" alt={{entry.title}}>
{% endif %}
But when I try to check the length of an empty index (where the image is not ), my template crashes saying I am trying to pull a method on a null variable. How do I check the presence of an image asset at index[1]
?