{% load i18n %}
{% load cradmin_image_tags %}

<div class="django_cradmin_imagewidget django_cradmin_filewidget {% if clearable %}django_cradmin_filewidget_clearable{% endif %}"
        django-cradmin-image-preview>
    {% if image_path %}
        <img src="{% cradmin_thumbnail image_path width=preview_width height=preview_height image_format=preview_format %}"
             django-cradmin-image-preview-img>
    {% else %}
        {# Used for the preview - hidden before we have a preview #}
        <img django-cradmin-image-preview-img>
    {% endif %}
    <div class="django_cradmin_filewidget_field_and_overlay_wrapper" django-cradmin-filefield-overlay>
        {{ input_html|safe }}
        <a class="btn btn-default django_cradmin_filewidget_fieldoverlay" href="#">
            <span class="fa fa-folder-open-o"></span>
            {% if image_path %}
                {% trans "Replace image" %}
            {% else %}
                {% trans "Upload image" %}
            {% endif %}
        </a>
    </div>
    {% if clearable %}
        <label class="django_cradmin_filewidget_clear">
            <input type="checkbox" name="{{ clear_checkbox_name }}">
            {% trans "Remove image" %}
        </label>
    {% endif %}
</div>
