diff --git a/templates/web/prod/actions/Tools/index.html.twig b/templates/web/prod/actions/Tools/index.html.twig index 596b970eda..4778e3430e 100644 --- a/templates/web/prod/actions/Tools/index.html.twig +++ b/templates/web/prod/actions/Tools/index.html.twig @@ -131,7 +131,7 @@ {% set height = record.get_technical_infos(dataH) %} {% if width and height %} - {% set ratio = width / height %} + {% set ratio = (width / height)|number_format(2, '.') %} {% else %} {% set ratio = '' %} {% endif %} diff --git a/www/prod/ThumbExtractor.js b/www/prod/ThumbExtractor.js index c4bbd77c3b..b235aa51cd 100644 --- a/www/prod/ThumbExtractor.js +++ b/www/prod/ThumbExtractor.js @@ -14,11 +14,13 @@ var maxH = elementDomNode.getHeight(); if ('' !== elementDomNode.getAspectRatio()) { - var h = Math.round(w * (1 / elementDomNode.getAspectRatio())); + var ratio = parseFloat(elementDomNode.getAspectRatio()); + + var h = Math.round(w * (1 / ratio)); if (h > maxH) { var h = maxH; - var w = Math.round(h * elementDomNode.getAspectRatio()); + var w = Math.round(h * ratio); } } else { var h = maxH;