So I have a website in which I upload images which get formated using the file manager ssystem but some of these are animated gifs and so I need to access the original uploaded file as the file manager compressed one is not longer animated I was hoping I could do an
If file type = gif
i.e
{if file type = gif}
{image}
{ifelse}
{image:midsize}
{/if}Maybe try the Variable Pair Usage along with the {extension} and the {url} variables.
For example: (untested)
{image}
{if extension == 'gif'}
{url}
{if:else}
{url:midsize}
{/if}
{/image}Edit to add:
You can use the Comparison Operator as Pedro suggested and the file name though, it’s file_name, not filename. Either one should work though, I would think the Contains Comparison Operator uses a tiny bit more resources. I’m not sure, however.
Thanks look simple to try
{exp:channel:entries channel="delightful" limit="10"}
<div class="entry">
{if file_name *= ".gif"}
{image}
{if:else}
{image:midsize}
{/if}
Submitted by {submitted_by}
{reasoning}
{rating}
</div>
{/exp:channel:entries}
</div>But I get this ?
Parse error: syntax error, unexpected ‘FALSE’ (T_STRING) in expressionengine/libraries/Functions.php(689) : eval()’d code on line 12
I like his method better. The only thing wrong with the other one is that it had to be enclosed in the tag as well.
Right!
So, just to thorough for future reference, that would look something like this:
{exp:channel:entries channel="delightful" disable="categories|category_fields|member_data|pagination" limit="10"}
<div class="entry">
{image}
{if file_name *= '.gif'}
{url}
{if:else}
{url:midsize}
{/if}
{/image}
Submitted by {submitted_by}
{reasoning}
{rating}
</div>
{/exp:channel:entries}Note: if you’re not using everything in the Channel Entries Tag consider turning some of it abilities off via the disable param. This can help performance.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.