mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Fix division by 0 in case a thumbnail has a width or height equal to 0
This commit is contained in:
@@ -3,23 +3,27 @@
|
|||||||
{% set b_height = b_h|default(b_w) %}
|
{% set b_height = b_h|default(b_w) %}
|
||||||
|
|
||||||
{% set b_ratio = b_width / b_height %}
|
{% set b_ratio = b_width / b_height %}
|
||||||
{% set i_ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
|
||||||
|
{% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
||||||
|
{% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
||||||
|
|
||||||
|
{% set i_ratio = thumbnail_width / thumbnail_height %}
|
||||||
|
|
||||||
{% if i_ratio > b_ratio%}
|
{% if i_ratio > b_ratio%}
|
||||||
{% if b_width > thumbnail.get_width() %}
|
{% if b_width > thumbnail_width %}
|
||||||
{% set d_width = thumbnail.get_width() %}
|
{% set d_width = thumbnail_width %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set d_width = b_width %}
|
{% set d_width = b_width %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set d_height = d_width / thumbnail.get_width() * thumbnail.get_height() %}
|
{% set d_height = d_width / thumbnail_width * thumbnail_height %}
|
||||||
{% set top = (b_height - d_height) / 2 %}
|
{% set top = (b_height - d_height) / 2 %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if b_height > thumbnail.get_height() %}
|
{% if b_height > thumbnail_height %}
|
||||||
{% set d_height = thumbnail.get_height() %}
|
{% set d_height = thumbnail_height %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set d_height = b_height %}
|
{% set d_height = b_height %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %}
|
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
|
||||||
{% set top = ((b_height - d_height) / 2) %}
|
{% set top = ((b_height - d_height) / 2) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -37,8 +41,8 @@
|
|||||||
{% set random = thumbnail.get_random() %}
|
{% set random = thumbnail.get_random() %}
|
||||||
<div class="record record_document imgTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
<div class="record record_document imgTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
||||||
<div id="preview_{{thumbnail.get_base_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
<div id="preview_{{thumbnail.get_base_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
swfobject.embedSWF("/include/FlexPaper_flash/FlexPaperViewer.swf",
|
swfobject.embedSWF("/include/FlexPaper_flash/FlexPaperViewer.swf",
|
||||||
@@ -50,20 +54,20 @@
|
|||||||
{% set random = thumbnail.get_random() %}
|
{% set random = thumbnail.get_random() %}
|
||||||
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
||||||
<div id="preview_{{thumbnail.get_base_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
<div id="preview_{{thumbnail.get_base_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
|
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
|
||||||
"preview_{{thumbnail.get_base_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
|
"preview_{{thumbnail.get_base_id()}}_{{thumbnail.get_record_id()}}_{{random}}",
|
||||||
"{{thumbnail.get_width()}}", "{{thumbnail.get_height()}}", "9.0.0", false, false,
|
"{{thumbnail_width}}", "{{thumbnail_height}}", "9.0.0", false, false,
|
||||||
{menu: "false",flashvars: "playerID=2&autostart=yes&noinfo=yes&animation=no&remaining=yes&soundFile={{thumbnail.get_url()}}", movie: "/include/jslibs/audio-player/player.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
|
{menu: "false",flashvars: "playerID=2&autostart=yes&noinfo=yes&animation=no&remaining=yes&soundFile={{thumbnail.get_url()}}", movie: "/include/jslibs/audio-player/player.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||||
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
||||||
src="{{thumbnail.get_url()}}" ondragstart="return false;">
|
src="{{thumbnail.get_url()}}" ondragstart="return false;">
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,13 @@
|
|||||||
{% set thumbnail = record.get_thumbnail() %}
|
{% set thumbnail = record.get_thumbnail() %}
|
||||||
{% set docType = record.get_type() %}
|
{% set docType = record.get_type() %}
|
||||||
{% set duration = "" %}
|
{% set duration = "" %}
|
||||||
{% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
|
||||||
|
{% if thumbnail.get_height() > 0 %}
|
||||||
|
{% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
||||||
|
{% else %}
|
||||||
|
{% set ratio = 1 %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% set wrapper_size = image_size + 30 %}
|
{% set wrapper_size = image_size + 30 %}
|
||||||
|
|
||||||
{% set types = {
|
{% set types = {
|
||||||
|
|||||||
@@ -18,23 +18,27 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{% set b_ratio = b_width / b_height %}
|
{% set b_ratio = b_width / b_height %}
|
||||||
{% set i_ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
|
||||||
|
{% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
||||||
|
{% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
||||||
|
|
||||||
|
{% set i_ratio = thumbnail_width / thumbnail_height %}
|
||||||
|
|
||||||
{% if i_ratio > b_ratio%}
|
{% if i_ratio > b_ratio%}
|
||||||
{% if b_width > thumbnail.get_width() %}
|
{% if b_width > thumbnail_width %}
|
||||||
{% set d_width = thumbnail.get_width() %}
|
{% set d_width = thumbnail_width %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set d_width = b_width %}
|
{% set d_width = b_width %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set d_height = d_width / thumbnail.get_width() * thumbnail.get_height() %}
|
{% set d_height = d_width / thumbnail_width * thumbnail_height %}
|
||||||
{% set top = (b_height - d_height) / 2 %}
|
{% set top = (b_height - d_height) / 2 %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if b_height > thumbnail.get_height() %}
|
{% if b_height > thumbnail_height %}
|
||||||
{% set d_height = thumbnail.get_height() %}
|
{% set d_height = thumbnail_height %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set d_height = b_height %}
|
{% set d_height = b_height %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %}
|
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
|
||||||
{% set top = ((b_height - d_height) / 2) %}
|
{% set top = ((b_height - d_height) / 2) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -54,8 +58,8 @@
|
|||||||
{% set random = thumbnail.get_random() %}
|
{% set random = thumbnail.get_random() %}
|
||||||
<div class="record record_video imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
<div class="record record_video imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
||||||
<div id="preview{{random}}" class="PNB"></div>
|
<div id="preview{{random}}" class="PNB"></div>
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
flowplayer("preview{{random}}",
|
flowplayer("preview{{random}}",
|
||||||
@@ -82,8 +86,8 @@
|
|||||||
{% set random = thumbnail.get_random() %}
|
{% set random = thumbnail.get_random() %}
|
||||||
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
||||||
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
|
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
|
||||||
@@ -94,8 +98,8 @@
|
|||||||
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||||
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
||||||
src="{% if lazyload %}/skins/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
|
src="{% if lazyload %}/skins/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if wrap %}
|
{% if wrap %}
|
||||||
</div>
|
</div>
|
||||||
@@ -125,19 +129,23 @@
|
|||||||
{% set b_height = b_h|default(b_w) %}
|
{% set b_height = b_h|default(b_w) %}
|
||||||
|
|
||||||
{% set b_ratio = b_width / b_height %}
|
{% set b_ratio = b_width / b_height %}
|
||||||
{% set i_ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
|
||||||
|
{% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
||||||
|
{% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
||||||
|
|
||||||
|
{% set i_ratio = thumbnail_width / thumbnail_height %}
|
||||||
|
|
||||||
{% if i_ratio > b_ratio%}
|
{% if i_ratio > b_ratio%}
|
||||||
{% set d_height = b_height %}
|
{% set d_height = b_height %}
|
||||||
{% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %}
|
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
|
||||||
{% set left = (b_height - d_height) / 2 %}
|
{% set left = (b_height - d_height) / 2 %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if b_height > thumbnail.get_height() %}
|
{% if b_height > thumbnail_height %}
|
||||||
{% set d_height = thumbnail.get_height() %}
|
{% set d_height = thumbnail_height %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set d_height = b_height %}
|
{% set d_height = b_height %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %}
|
{% set d_width = d_height * thumbnail_width / thumbnail_height %}
|
||||||
{% set top = ((b_height - d_height) / 2) %}
|
{% set top = ((b_height - d_height) / 2) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -157,8 +165,8 @@
|
|||||||
{% set random = thumbnail.get_random() %}
|
{% set random = thumbnail.get_random() %}
|
||||||
<div class="record record_video imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
<div class="record record_video imgTips" style="position:relative;width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
||||||
<div id="preview{{random}}" class="PNB"></div>
|
<div id="preview{{random}}" class="PNB"></div>
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
flowplayer("preview{{random}}",
|
flowplayer("preview{{random}}",
|
||||||
@@ -183,8 +191,8 @@
|
|||||||
{% set random = thumbnail.get_random() %}
|
{% set random = thumbnail.get_random() %}
|
||||||
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
<div class="record record_audio audioTips" style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;">
|
||||||
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
<div id="preview_{{thumbnail.get_sbas_id()}}_{{thumbnail.get_record_id()}}_{{random}}" class="PNB" style=""></div>
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
|
swfobject.embedSWF("/include/jslibs/audio-player/player.swf",
|
||||||
@@ -195,8 +203,8 @@
|
|||||||
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||||
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
||||||
src="{{url}}" ondragstart="return false;">
|
src="{{url}}" ondragstart="return false;">
|
||||||
<input type="hidden" name="width" value="{{thumbnail.get_width()}}"/>
|
<input type="hidden" name="width" value="{{thumbnail_width}}"/>
|
||||||
<input type="hidden" name="height" value="{{thumbnail.get_height()}}"/>
|
<input type="hidden" name="height" value="{{thumbnail_height}}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if wrap %}
|
{% if wrap %}
|
||||||
</div>
|
</div>
|
||||||
@@ -204,3 +212,4 @@
|
|||||||
|
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,18 @@
|
|||||||
{% set thumbnail = record.get_thumbnail() %}
|
{% set thumbnail = record.get_thumbnail() %}
|
||||||
{% if thumbnail.is_paysage() %}
|
{% if thumbnail.is_paysage() %}
|
||||||
{% set w = 140 %}
|
{% set w = 140 %}
|
||||||
{% set h = (w / (thumbnail.get_width() / thumbnail.get_height()))|round %}
|
{% if thumbnail.get_height() > 0 and thumbnail.get_width() > 0 %}
|
||||||
|
{% set h = (w / (thumbnail.get_width() / thumbnail.get_height()))|round %}
|
||||||
|
{% else %}
|
||||||
|
{% set h = 140 %}
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set h = 105 %}
|
{% set h = 105 %}
|
||||||
{% set w = (h * (thumbnail.get_width() / thumbnail.get_height()))|round %}
|
{% if thumbnail.get_height() > 0 %}
|
||||||
|
{% set w = (h * (thumbnail.get_width() / thumbnail.get_height()))|round %}
|
||||||
|
{% else %}
|
||||||
|
{% set w = 105 %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<img width="{{ w ~ 'px' }}" height="{{ h ~ 'px' }}" src="{{ thumbnail.get_url() }}" />
|
<img width="{{ w ~ 'px' }}" height="{{ h ~ 'px' }}" src="{{ thumbnail.get_url() }}" />
|
||||||
@@ -117,4 +125,4 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
{% set thumbnail = child.getRecord(app).get_thumbnail() %}
|
{% set thumbnail = child.getRecord(app).get_thumbnail() %}
|
||||||
{% if thumbnail.is_paysage() %}
|
{% if thumbnail.is_paysage() %}
|
||||||
{% set style = 'width:65px;top:' %}
|
{% set style = 'width:65px;top:' %}
|
||||||
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
{% if thumbnail.get_width() > 0 and thumbnail.get_height() > 0 %}
|
||||||
|
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
||||||
|
{% else %}
|
||||||
|
{% set top = 65 %}
|
||||||
|
{% endif %}
|
||||||
{% set style = style ~ top %}
|
{% set style = style ~ top %}
|
||||||
{% set style = style ~ 'px;' %}
|
{% set style = style ~ 'px;' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
{% set thumbnail = child.get_record().get_thumbnail() %}
|
{% set thumbnail = child.get_record().get_thumbnail() %}
|
||||||
{% if thumbnail.is_paysage() %}
|
{% if thumbnail.is_paysage() %}
|
||||||
{% set style = 'width:65px;top:' %}
|
{% set style = 'width:65px;top:' %}
|
||||||
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
{% if thumbnail.get_width() > 0 and thumbnail.get_height() > 0 %}
|
||||||
|
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
||||||
|
{% else %}
|
||||||
|
{% set top = 65 %}
|
||||||
|
{% endif %}
|
||||||
{% set style = style ~ top %}
|
{% set style = style ~ top %}
|
||||||
{% set style = style ~ 'px;' %}
|
{% set style = style ~ 'px;' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -40,4 +44,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="PREVIEWTOOL">
|
<div id="PREVIEWTOOL">
|
||||||
{% include 'prod/preview/tools.html.twig' %}
|
{% include 'prod/preview/tools.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
{% set regroupement = record.get_container() %}
|
{% set regroupement = record.get_container() %}
|
||||||
{% set thumbnail = regroupement.get_thumbnail() %}
|
{% set thumbnail = regroupement.get_thumbnail() %}
|
||||||
|
|
||||||
{% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
{% if thumbnail.get_height() > 0 %}
|
||||||
|
{% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
||||||
|
{% else %}
|
||||||
|
{% set ratio = 1 %}
|
||||||
|
{% endif %}
|
||||||
{% if thumbnail.is_paysage %}
|
{% if thumbnail.is_paysage %}
|
||||||
{% set style = 'width:80px;top:' %}
|
{% set style = 'width:80px;top:' %}
|
||||||
{% set top = (8 + (80 - (80 / ratio)) / 2)|round %}
|
{% set top = (8 + (80 - (80 / ratio)) / 2)|round %}
|
||||||
@@ -59,4 +63,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="PREVIEWTOOL">
|
<div id="PREVIEWTOOL">
|
||||||
{% include 'prod/preview/tools.html.twig' %}
|
{% include 'prod/preview/tools.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user