diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index 56e3c0a48..76937ea4f 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -426,9 +426,10 @@ var Display = { var section = document.createElement("section"); section.setAttribute("id", index); section.setAttribute("data-background", "#000"); + section.setAttribute("style", "height: 100%; width: 100%;"); var img = document.createElement('img'); img.src = slide["path"]; - img.setAttribute("style", "height: 100%; width: 100%;"); + img.setAttribute("style", "max-width: 100%; height: auto; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"); section.appendChild(img); slidesDiv.appendChild(section); Display._slides[index.toString()] = index; diff --git a/openlp/core/widgets/views.py b/openlp/core/widgets/views.py index c3f4be0ca..a1d065307 100644 --- a/openlp/core/widgets/views.py +++ b/openlp/core/widgets/views.py @@ -210,9 +210,13 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties): pixmap = QtGui.QPixmap(str(slide['image'])) else: pixmap = QtGui.QPixmap(str(slide['path'])) + if pixmap.height() > 0: + pixmap_ratio = pixmap.width() / pixmap.height() + else: + pixmap_ratio = 1 label.setPixmap(pixmap) container = QtWidgets.QWidget() - layout = AspectRatioLayout(container, self.screen_ratio) + layout = AspectRatioLayout(container, pixmap_ratio) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(label) container.setLayout(layout)