How do I use an if/else statement to determine if a field is filled in? I know how to add images into my template:

{% set image = entry.featureImage.first() %}
&lt;div class="imagewrapper"&gt;
    &lt;img src="{{ image.getUrl() }}" width="{{ image.getWidth('banner') }}" height="{{ image.getHeight('banner') }}"&gt;
&lt;/div&gt;


But what if my client doesn't have feature images for all of his entries? I need some function that'll tell the website, if there is no image, omit &lt;div class="imagewrapper"&gt;.

Perhaps some kind of if/else statement that I can use:

{% if
    //the featureimage for this entry is filled in
%}
    {% set image = entry.featureImage.first() %}
    &lt;div class="imagewrapper"&gt;
        &lt;img src="{{ image.getUrl() }}" width="{{ image.getWidth('banner') }}" height="{{ image.getHeight('banner') }}"&gt;
    &lt;/div&gt;
{% endif %}
You can use the length Twig filter for that.

{% if entry.featureImage | length %}
    {% set image = entry.featureImage.first() %}
    &lt;div class="imagewrapper"&gt;
       &lt;img src="{{ image.getUrl() }}" width="{{ image.getWidth('banner') }}" height="{{ image.getHeight('banner') }}"&gt;
    &lt;/div&gt;
{% endif %}


If there isn't an image in featureImage then nothing will be output.