The new experimental PhotoSwipeLightbox (siteSettings.experimental_lightbox) contain bugs when the image link exists in Discourse Solved or the upload component in admin/config/logo and somewhere without a rendered [img] html mark.
The root cause is that PhotoSwipeLightbox need width and height from the already-loaded image, while Discourse Solved and the upload component don’t have these attributes.
Without these attributes, the image will be stretched to fill the browser window, causing distortion, as shown in the figure attached.
This commit add a preload mechanism for images without dimensions to get their dimensions, so that they can be displayed normally.