I have a piece of code whereby I adjust the output of a file depending on it's file extension:
{section_1_files}
{section_1_files:file}
{if {extension} == 'jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF'}
<figure>
<img src="{url}" alt="{section_1_files:label}" />
</figure>
{if:else}
<div class="file">
<a href="{url}">{section_1_files:label}</a>
</div>
{/if}
{/section_1_files:file}
{/section_1_files}
However it doesn't seem to be working properly. If I add {extension}
below the {section_1_files:file}
line then jpg
is displayed on the front end. The following code currently outputs this:
<div class="file">
<a href="http://domain.co.uk/uploads/test-image.jpg">Test image</a>
</div>
<div class="file">
<a href="http://domain.co.uk/uploads/test-file.docx">Test file</a>
</div>
Any help would be greatly appreciated.