Aspect ratio corrective

This commit is contained in:
Nicolas Le Goff
2013-03-22 14:43:44 +01:00
committed by Romain Neutron
parent 128f69e314
commit e57bf3186e
2 changed files with 5 additions and 3 deletions

View File

@@ -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 %}

View File

@@ -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;