{# This file is part of the Sonata package. (c) Thomas Rabaix For the full copyright and license information, please view the LICENSE file that was distributed with this source code. #} {% import _self as macros %} {% macro bytesToSize(bytes) %} {% spaceless %} {% set kilobyte = 1024 %} {% set megabyte = kilobyte * 1024 %} {% if bytes < kilobyte %} {{ bytes ~ ' B' }} {% elseif bytes < megabyte %} {{ (bytes / kilobyte)|number_format(2) ~ ' KB' }} {% else %} {{ (bytes / megabyte)|number_format(2) ~ ' MB' }} {% endif %} {% endspaceless %} {% endmacro %} {% extends '@SonataAdmin/CRUD/base_edit.html.twig' %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block form %}
{% if object.id %}
{% block sonata_media_show_reference %}

{{ 'title.media_preview'|trans({}, 'SonataMediaBundle') }}

{% if sonata_media.pixlr and sonata_media.pixlr.isEditable(object) %}
{% endif %}
{% media object, 'reference' with {'class': 'img-responsive img-rounded'} %}
{% for name, format in sonata_media.pool.formatNamesByContext(object.context) %} {% endfor %}
{{ 'label.size'|trans({}, 'SonataMediaBundle') }} {{ object.width }} x {{ object.height }} {% if object.size > 0 %}({{ macros.bytesToSize(object.size) }}){% endif %}
{{ 'label.content_type'|trans({}, 'SonataMediaBundle') }} {{ object.contenttype }}
{{ 'label.cdn'|trans({}, 'SonataMediaBundle') }} {% if object.cdnisflushable %} {{ 'label.to_be_flushed'|trans({}, 'SonataMediaBundle') }} {% else %} {{ 'label.flushed_at'|trans({}, 'SonataMediaBundle') }} {{ object.cdnflushat|date }} {% endif %}
{{ 'label.protected_download_url'|trans({}, 'SonataMediaBundle') }} {{ 'label.protected_download_url_notice'|trans({}, 'SonataMediaBundle') }} {{ sonata_media.pool.downloadStrategy(object).description|raw }}
reference
{{ name }}
{% endblock sonata_media_show_reference %}
{% endif %}
{# Renders the form #} {{ parent() }}
{% if sonata_media.pixlr and sonata_media.pixlr.isEditable(object) %} {% endif %} {% endblock form %}