mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
45 lines
2.2 KiB
Twig
45 lines
2.2 KiB
Twig
{% macro format(thumbnail, box_w, box_h, extra_class, wrap, lazyload, autoplay) %}
|
|
{% set record_type = thumbnail.get_type() %}
|
|
{% set box_w = box_w|round %}
|
|
{% set box_h = box_h|default(box_w)|round %}
|
|
{% set url = app.getAuthenticator().isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %}
|
|
{% set original_h = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
|
{% set original_w = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
|
{% if wrap %}
|
|
<div style="width:{{box_w}}px;height:{{box_h}}px;" class="thumb_wrapper {{extra_class|default('')}}" >
|
|
{% endif %}
|
|
|
|
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
|
|
<div style="width:{{original_w}}px;height: {{ original_h }}px" class="videoTips">
|
|
|
|
<iframe width="100%" height="100%"
|
|
src="{{ url('alchemy_embed_view', ['url': url, 'autoplay': autoplay|default('false')]) }}"
|
|
frameborder="0" allowfullscreen></iframe>
|
|
</div>
|
|
{% elseif record_type == 'FLEXPAPER' %}
|
|
<iframe width="100%" height="100%"
|
|
src="{{ url('alchemy_embed_view', ['url': url, 'autoplay': autoplay|default('false')]) }}"
|
|
frameborder="0" allowfullscreen></iframe>
|
|
{% elseif record_type == 'AUDIO_MP3' %}
|
|
<iframe width="100%" height="100%"
|
|
src="{{ url('alchemy_embed_view', ['url': url, 'autoplay': autoplay|default('false')]) }}"
|
|
frameborder="0" allowfullscreen></iframe>
|
|
{% else %}
|
|
{% set fit_size = fitIn(
|
|
{"width":original_w, "height":original_h},
|
|
{"width":box_w, "height":box_h}
|
|
)%}
|
|
|
|
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
|
style="width:{{fit_size.width}}px;height:{{fit_size.height}}px;top:{{fit_size.top}}px;"
|
|
src="{% if lazyload %}/assets/common/images/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
|
|
<input type="hidden" name="width" value="{{original_w}}"/>
|
|
<input type="hidden" name="height" value="{{original_h}}"/>
|
|
|
|
{% endif %}
|
|
|
|
{% if wrap %}
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|