Third party Unfortunately, there is yet another lightGallery problem: iOS / Mobile Safari sometimes crops images

Affected version
2.0.9

Steffen

Well-known member
Unfortunately, the image gallery used by XenForo (lightGallery) doesn't only seem to have blurry rendering issues on Android, a broken back button behaviour and erratic pinch-to-zoom-support. It also seems to sporadically crop images on iOS / Mobile Safari. :(

Similar to the blurry rendering issue on Android, this bug isn't reliably reproducable (maybe the issues even have the same root-cause because in both cases the image rendering seems to be interrupted prematurely). For example, I cannot reproduce it in BrowserStack but (in addition to the report by one of our users) it was confirmed by a member of our team on an iPhone 6 running iOS 11.3.1. The original bug report (which is in german but there is a screenshot attached that shows the bug) links to a test-page which unfortunately is in a semi-private forum. I've asked the user whether he'd be fine with posting these images in a public thread but... on the other hand... does a bug-report in lightGallery really make sense anymore considering that this project seems to be more or less abandoned?

I think the only future-proof course of action would be to replace lightGallery with something better. As @Chris D already said in one of the other threads linked above, the popular alternative PhotoSwipe doesn't seem to be well-maintained either (no commits since February, 400 open issues). Maybe fancybox could be an alternative? It's working fine for me on Android, the back button works and it has really smooth pinch-to-zoom support. :unsure:

Edit: I've attached a screenshot made by the mentioned member of our team. Left: when gallery first opened, Right: after swiping to other images and back again
 

Attachments

Last edited:

Steffen

Well-known member
These are the images. Maybe the problem visible on the above screenshot can be reproduced here, too.

Edit: It seems like xenforo.com uses a more aggressive image resizing which could impact the reproducability. It could be that this issue is less likely to occur with smaller images.
 

Attachments

Fethi.dz

Well-known member
I have the same issue since xF2.0. I never experienced this kind lf issue in xF1.5. Hopefully Team XF can do something about it.
 

Chris D

XenForo developer
Staff member
There's not likely going to be a lot we can do in the short term, unfortunately.

Though you should keep in mind that you may have already identified a workaround in that it may be less reproducible with smaller images. We'd recommend at least testing if that is true, or not. Because if it isn't related to the size of the image, then there could be other factors involved.

It's not just "less reproducible" here, I've never seen it here. So either the image size is a reasonable workaround or there are other factors that need to be addressed which are more specific to your setup.
 

Steffen

Well-known member
This specific issue has not yet been reported to occur here on XenForo.com. The three other issue have been reproduced here, too: blurry rendering issues on Android, broken back button behavior and erratic pinch-to-zoom-support. I've chosen this bug report for my follow-up question because I thought that the first paragraph contained a nice summary of the XenForo gallery issues.

I don't think that reducing the maximum attachment size or more aggressive downscaling are viable workarounds for us. :(

The lightGallery project seems dead. It has annoying bugs (see above), on GitHub it has 137 open issues that nobody seems to care about and it had less than 10 commits in 2018 (meaning that it's probably pointless to wait for fixes). Unfortunately, the alternatives seem to be scarce. The one that looks very promising to me is Fancybox (49 open and 1986 closed issues, IMHO looks and feel great). Unfortunately, it requires commercial licensing but considering that XenForo seems to have also licensed Font Awesome, maybe a commercial license is not really an obstacle and a deal could be reached with the Fancybox developers?
 

Chris D

XenForo developer
Staff member
There's not likely going to be a lot we can do in the short term, unfortunately.
I feel like this needs to be reiterated.

We have been discussing options but realistically you can’t expect us to pick a lightbox, implement it and swap that out in a maintenance release.

First of all, I think we’ve proved already, that if we pick a third party for this, it’s not a decision to be taken lightly. We paid for a commercial license for lightGallery too btw and that was very active when we chose it. The "Extended commercial license" of fancybox would cover us and clearly we're not going to lose sleep over $119 :)

Secondly, there are other options besides just using yet another vendor’s lightbox. We might want to consider forking and fixing lightGallery, we could indeed use another third party one, or we could even write our own.

These are discussions we are having and decisions we will be making but please don’t expect the changes any time soon. These are potentially significant changes, and potentially significant breaking changes, so realistically I wouldn’t expect any big changes before XF 2.2.

In the meantime, it would at least be useful if you could help us by ascertaining if the resizing of images is a factor. Clearly if it’s still happening with smaller images, then it may not actually be a bug in the lightbox.

Other than that, maybe the author will eventually come through and start working on this again.
 

Steffen

Well-known member
The three bugs were opened in March, May, and July 2018. Last year, I was therefore hoping for a new/improved/fixed gallery in XenForo 2.1. Now, I don't expect a fix in XenForo 2.1.x (as you say, it's not a small change). But I hope that something can be done for XenForo 2.2. 👍

Saying for sure whether the problem only or preferrably exists with larger images is difficult because it only happens sporadically. I've created a post with 5 large images (3840 pixels wide) and a post with 5 smaller images (800 pixels wide) for testing purposes. So far, two users were not able to reproduce the issue at all. One was able to reproduce the issue on first try with the large images (screenshot) but not on second or third try, although he cleared his browser cache (so it's unfortunately pointless to try with the smaller images). I've asked another iPhone user for help who says he sees this problem quite often.

That being said, there is another strong hint that this bug is timing-related: It seems like the same issue was reported to the lightGallery developers about one year ago (images cut off at bottom sometimes until swiping all the way through gallery). No solution was found but the reporter said: "It appears to be a problem when either the server or the client has a slow connection". The filesize impacts such timing-related issues ("race conditions"), too.

It's complicated but I think it's relatively clear that this is a timing-related issue and therefore influenced by filesize, connection speed/latency and probably also CPU speed. Unfortunately, I myself can't reproduce it (and you said you cannot, too), at least not reliably. In combination with the lack of development happening on lightGallery, this makes it a very difficult problem to solve. Considering the other lightGallery issues, I therefore think that it could maybe make more sense to look for alternatives like Fancybox.
 

Steffen

Well-known member
The iPhone user who is able to trigger the issue relatively often says that the issue sporadically happens with the small as well as with the large images. It seems to be random.
 

penturners

New member
Is there any update on this issue? Still a potential fix coming in 2.2? I just switched my 1.8m post vb3.7 to XF in large part due to the need for better native mobile support, and my users are experiencing this partial cropping issue on IOS.
 
Top