{% extends "EzPublishCoreBundle::content_fields.html.twig" %}

{% block ezimage_field %}
{% spaceless %}
{% if field.value %}
    {% set imageAlias = get_image_variation( field, versionInfo, parameters.alias|default( 'original' ) ) %}
{% if parameters.linkHref is defined and parameters.linkHref %}
<a {% if parameters.linkTitle is defined ? parameters.linkHref :'' %}title="{{ parameters.linkTitle is defined ? parameters.linkHref :'' }}" {% endif %}href="{{ parameters.linkHref }}"{% if parameters.linkTarget is defined ? parameters.linkHref :'' %} target="{{ parameters.linkTarget is defined ? parameters.linkHref :'' }}"{% endif %}>
{% endif %}
    <img src="{% if imageAlias %}{{ asset( imageAlias.uri ) }}{% else %}//:0{% endif %}"{% if imageAlias.width is defined and imageAlias.width is not empty %} width="{{ imageAlias.width }}"{% endif %}{% if imageAlias.height is defined and imageAlias.height is not empty %} height="{{ imageAlias.height }}"{% endif %} alt="{{ parameters.alt|default( field.value.alternativeText ) }}" {{ block( 'field_attributes' ) }}/>
{% if parameters.linkHref is defined and parameters.linkHref %}
</a>
{% endif %}
{% endif %}
{% endspaceless %}
{% endblock %}