From 699901c24336e9dfd554ecfec8400616e48b2674 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 9 Nov 2022 18:21:56 -0800 Subject: [PATCH] Contain images without dims (#176) --- src/components/Viewer.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Viewer.vue b/src/components/Viewer.vue index 5e14d37b..c3baa61f 100644 --- a/src/components/Viewer.vue +++ b/src/components/Viewer.vue @@ -470,7 +470,8 @@ export default class Viewer extends Mixins(GlobalMixin) { // Get the thumbnail image this.photoswipe.addFilter("thumbEl", (thumbEl, data, index) => { const photo = this.list[index - this.globalAnchor]; - if (!photo || photo.flag & this.c.FLAG_IS_VIDEO) return thumbEl; + if (!photo || !photo.w || !photo.h || photo.flag & this.c.FLAG_IS_VIDEO) + return thumbEl; return this.thumbElem(photo) || thumbEl; }); @@ -840,6 +841,10 @@ export default class Viewer extends Mixins(GlobalMixin) { width: 100%; } + img.pswp__img { + object-fit: contain; + } + .pswp__button { color: white;