Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some SVGs display as 0x0 image #552

Closed
Pilchard123 opened this issue Oct 31, 2016 · 3 comments
Closed

Some SVGs display as 0x0 image #552

Pilchard123 opened this issue Oct 31, 2016 · 3 comments

Comments

@Pilchard123
Copy link

Pilchard123 commented Oct 31, 2016

Some SVG files will open fine in a lightbox; others will collapse to a 0x0 image. I'm not sure what it is that makes the difference, but it may be related to viewbox or height/width attributes in the SVG itself. The behaviour does not seem to be consistent across browsers. In the example below, Firefox 49 and IE11 will collapse the left image, IE collapses both, and Chrome 53 and 54 work fine. I have not tested in other browsers.

Lightbox version: 2.9.0
Reproduced in:

  • Firefox 49.0.2, Windows 7
  • IE11, Windows 7

To reproduce:

  1. Create a lightbox-enabled link to an SVG image (I think there is a particular quality of the image that matters, but I don't know what it is)
  2. Click the link to open the lightbox

Example: https://jsfiddle.net/Lj7cfnkL/9/ . The left-hand image is SVG and does not work as expected. The centre image is SVG and does work as expected. The right-hand image is PNG.

@Pilchard123 Pilchard123 changed the title Some SVGs display as 0x0 Some SVGs display as 0x0 image Oct 31, 2016
@achaios
Copy link

achaios commented Nov 29, 2017

Here's a patch that fixes it. This is against 2.10.0 source, but I have only tested it on 2.9.0.
The culprit is that some svgs report 0x0 size, so we just display them with maximum size.
lightbox-fix-for-0-size-svgs.zip
Github doesn't allow attaching *.patch files? How strange.

@lokesh
Copy link
Owner

lokesh commented Apr 20, 2019

9ea5e60

@lokesh lokesh mentioned this issue Apr 22, 2019
@lokesh
Copy link
Owner

lokesh commented Apr 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants