Discussions

Ask a Question
Back to All

Read out default image set with editable_file: Best practices?

When I set default images for the editable_file tag as suggested here, there doesn't seem to be a nice way to read out the editable_file url: for the default image, I need the theme_image_url filter, if I set the editable file in the backend

My current solution is to check wheter the url contains certain strings and decide wheter to apply the filter or not:

{% if person_sidebar_img contains 'pages' or person_sidebar_img contains 'content_entry' %}
    <img class="img-responsive" src='{{ person_sidebar_img }}'>
  {% else %}
    <img class="img-responsive" src="{{ 'default/teacher.png' | theme_image_url }}">
{% endif %}

This is of course not necessarily update-safe and seems redundant. Any ideas on how to handle default and uploaded images at the same time?

(Of course, on wagon this problem doesn't exist, since the default url works without the theme_img_url filter.)