From 33f463599a69c19e5ad803b8ffa9e6acb3c47adb Mon Sep 17 00:00:00 2001 From: sean Date: Sun, 28 Aug 2016 23:53:48 +0200 Subject: [PATCH 1/2] limit image scale in pdf documents (fixes #2301) --- openslides/core/static/js/core/site.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index a178bee5f..ccb35af3b 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -355,10 +355,32 @@ angular.module('OpenSlidesApp.core.site', [ alreadyConverted.push(stack); break; case "img": + // TODO: need a proper way to calculate the space + // left on the page. + // This requires further information + // A4 in 72dpi: 595px x 842px + var maxResolution = { + width: 590, + height: 840 + }, + width = parseInt(element.getAttribute("width")), + height = parseInt(element.getAttribute("height")); + + if (width > maxResolution.width) { + var scaleByWidth = maxResolution.width/width; + width *= scaleByWidth; + height *= scaleByWidth; + } + if (height > maxResolution.height) { + var scaleByHeight = maxResolution.height/height; + width *= scaleByHeight; + height *= scaleByHeight; + } + alreadyConverted.push({ image: BaseMap[element.getAttribute("src")], - width: parseInt(element.getAttribute("width")), - height: parseInt(element.getAttribute("height")) + width: width, + height: height }); break; case "ul": From 24b95e5fbc2cded43065966ffffd7e518b1796b8 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 31 Aug 2016 09:58:26 +0200 Subject: [PATCH 2/2] Scale image size also in detail and projector view. --- openslides/core/static/css/app.css | 4 ++++ openslides/core/static/css/projector.css | 4 ++++ openslides/core/static/js/core/site.js | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index 4c20c4ce5..c3c02d6b9 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -318,6 +318,10 @@ img { margin-right: 13px; } +.col1 .details img { + max-width: 100%; + height: auto; +} .col1 ul, .col1 ol { margin-left: 20px; } diff --git a/openslides/core/static/css/projector.css b/openslides/core/static/css/projector.css index 6bb6d300d..835ae4dfe 100644 --- a/openslides/core/static/css/projector.css +++ b/openslides/core/static/css/projector.css @@ -81,6 +81,10 @@ body{ z-index: -1; line-height: 1.3em; } +.content img { + max-width: 65%; + height: auto; +} .scrollcontent { transition-property: margin, font-size; transition-duration: 1s; diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index ccb35af3b..03b41a9a3 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -360,8 +360,8 @@ angular.module('OpenSlidesApp.core.site', [ // This requires further information // A4 in 72dpi: 595px x 842px var maxResolution = { - width: 590, - height: 840 + width: 435, + height: 830 }, width = parseInt(element.getAttribute("width")), height = parseInt(element.getAttribute("height"));