mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
Aspect ratio corrective
This commit is contained in:
committed by
Romain Neutron
parent
128f69e314
commit
e57bf3186e
@@ -131,7 +131,7 @@
|
|||||||
{% set height = record.get_technical_infos(dataH) %}
|
{% set height = record.get_technical_infos(dataH) %}
|
||||||
|
|
||||||
{% if width and height %}
|
{% if width and height %}
|
||||||
{% set ratio = width / height %}
|
{% set ratio = (width / height)|number_format(2, '.') %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set ratio = '' %}
|
{% set ratio = '' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -14,11 +14,13 @@
|
|||||||
var maxH = elementDomNode.getHeight();
|
var maxH = elementDomNode.getHeight();
|
||||||
|
|
||||||
if ('' !== elementDomNode.getAspectRatio()) {
|
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) {
|
if (h > maxH) {
|
||||||
var h = maxH;
|
var h = maxH;
|
||||||
var w = Math.round(h * elementDomNode.getAspectRatio());
|
var w = Math.round(h * ratio);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var h = maxH;
|
var h = maxH;
|
||||||
|
|||||||
Reference in New Issue
Block a user