1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Lightbox behaviour

Discussion in 'Troubleshooting and Problems' started by MattW, Jan 26, 2013.

  1. MattW

    MattW Well-Known Member

    A few of my members with slower internet connections are having problems with viewing larger images in the lightbox popup.

    Example post:
    Contains 18 images, total size 58.1MB

    Looking at what it's doing using Chrome, when you load lightbox from the first image, it's actually downloading ALL the full images at once to generate the main image, plus the thumbnails used to scroll through.


    Then, when you click onto the next image, it's downloading the file twice, for what I can only assume is to load the main image, and the thumbnail again.

    This is from me scrolling through the next 2 pictures

    So viewing those 18 images in sequence in lightbox actually ends up using 180MB of bandwidth (n)

    Has anyone else notices this? I hadn't really noticed it on my fast connection, but people on less than 10MB connections are starting to pick up on it.
  2. cclaerhout

    cclaerhout Well-Known Member

  3. MattW

    MattW Well-Known Member

    Haven't tried with Firefox. Will install and test now
  4. MattW

    MattW Well-Known Member

    Have tried with Firefox, and it's working as expected. It initially loads all the images, and then loads each image individually (only once) as you scroll through the images. You can then move back and forward between the ones already viewed without them being re-downloaded each time.
  5. cclaerhout

    cclaerhout Well-Known Member

    So you arrived at the same conclusion that I have when I've checked the problem when loading style properties in chrome. I haven't try yet to configure JavaScript using the full path.

    This is clearly the most major problem of XenForo right now. I don't know after which update of chrome it happened.
  6. MattW

    MattW Well-Known Member

    Yes, it's only when using Chrome. I also had a look at the other links and get the same behavior in the ACP as described.

    This could become a problem as Chrome is now the most used browser on our site
  7. cclaerhout

    cclaerhout Well-Known Member

  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    cclaerhout likes this.
  9. MattW

    MattW Well-Known Member

    Not sure where to add that fix :(

    This is the console output

    I've had a look at the html output when lightbox is in use. The thumbnails are actually the smaller thumbnail images:

    However, it's loading the FULL main image twice:

    The second img id="LbImg" looks to be getting downloaded and loaded, but isn't visible.
  10. cclaerhout

    cclaerhout Well-Known Member

    No sorry I don't think this this fix will solve your problem. I haven't tested the bug you describe but its behaviour looks like the one Jake opened a new thread for (see above).
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In my testing both Chrome and Firefox appear to have the same behavior. They preload all full-sized images shown in the lightbox. When clicking through the images I get 304 responses for each request, the images having already been downloaded. This behavior is as expected, though the argument can be made for a configurable option to disable the precaching.

    You say your browser is redownloading the full images as you navigation through the lightbox? Are you sure? It's not a 304?
  12. MattW

    MattW Well-Known Member

    Yes, I'm getting a 200 response.

    These are the access logs from just now as I browse through the images in that same thread in lightbox:

    root@vps [~]# tail -f /usr/local/apache/logs/access_log | grep - - [28/Jan/2013:07:09:23 +0000] "GET /forum/attachments/2012-10-13-11-17-11-jpg.8942/ HTTP/1.1" 200 2660829 - - [28/Jan/2013:07:09:24 +0000] "GET /forum/attachments/2012-10-13-10-42-42-jpg.8941/ HTTP/1.1" 200 3106903 - - [28/Jan/2013:07:09:24 +0000] "GET /forum/attachments/2012-10-13-11-17-11-jpg.8942/ HTTP/1.1" 200 2660829 - - [28/Jan/2013:07:09:40 +0000] "GET /forum/attachments/2012-10-13-11-17-11-jpg.8942/ HTTP/1.1" 200 2660829 - - [28/Jan/2013:07:09:40 +0000] "GET /forum/attachments/2012-09-19-09-50-17-jpg.8943/ HTTP/1.1" 200 3770537 - - [28/Jan/2013:07:09:42 +0000] "GET /forum/attachments/2012-10-13-11-17-11-jpg.8942/ HTTP/1.1" 200 2660829 - - [28/Jan/2013:07:09:41 +0000] "GET /forum/attachments/2012-09-19-09-50-17-jpg.8943/ HTTP/1.1" 200 3770537 - - [28/Jan/2013:07:09:42 +0000] "GET /forum/attachments/2012-10-13-11-17-11-jpg.8942/ HTTP/1.1" 200 2660829 - - [28/Jan/2013:07:09:42 +0000] "GET /forum/attachments/2012-09-19-09-50-17-jpg.8943/ HTTP/1.1" 200 3770537 - - [28/Jan/2013:07:09:43 +0000] "GET /forum/attachments/2012-09-19-09-50-17-jpg.8943/ HTTP/1.1" 200 3770537 - - [28/Jan/2013:07:09:48 +0000] "GET /forum/attachments/2012-09-19-09-50-24-jpg.8944/ HTTP/1.1" 200 3282346 - - [28/Jan/2013:07:09:48 +0000] "GET /forum/attachments/2012-09-19-09-50-17-jpg.8943/ HTTP/1.1" 200 3770537 - - [28/Jan/2013:07:09:49 +0000] "GET /forum/attachments/2012-09-19-09-50-24-jpg.8944/ HTTP/1.1" 200 3282346 - - [28/Jan/2013:07:09:49 +0000] "GET /forum/attachments/2012-09-19-09-50-17-jpg.8943/ HTTP/1.1" 200 3770537 - - [28/Jan/2013:07:09:50 +0000] "GET /forum/attachments/2012-09-19-09-50-24-jpg.8944/ HTTP/1.1" 200 3282346 - - [28/Jan/2013:07:09:50 +0000] "GET /forum/attachments/2012-09-19-09-50-24-jpg.8944/ HTTP/1.1" 200 3282346
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Maybe it's a problem with the server vars. This is the relevant code:


    		$eTag = $this->_request->getServer('HTTP_IF_NONE_MATCH');
    		if ($eTag && $eTag == $attachment['attach_date'])
    			return $this->responseView('XenForo_ViewPublic_Attachment_View304');
    If you would like I can debug this if you give me access.
  14. MattW

    MattW Well-Known Member

    Sure, what access do you require Jake?
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin access, and maybe FTP.
  16. MattW

    MattW Well-Known Member

    Will drop you a PM with the details.
  17. MattW

    MattW Well-Known Member

    I'd like to thank Jake for his help in getting to the bottom of this.

    For clarification, the issue was on my end, and not a problem with Lightbox or XenForo.

    Jake spent some time debug'ing the response headers:

    This was actually something that I had set in my .htaccess file, from a "guide" I followed from a resource on the shop software forum I also use, and had been there since 2010!

    # Force no caching for dynamic files
    <FilesMatch "\.(php|cgi|pl|htm)$">
    ExpiresActive Off
    Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
    Header set Pragma "no-cache"
    I've removed that, and it's working as expected again.

    Request URL:http://www.z22se.co.uk/forum/attachments/2012-09-19-09-50-24-jpg.8944/
    Request Method:GET
    Status Code:304 Not Modified
    Request Headers
    If-Modified-Since:Mon, 04 Feb 2013 00:38:41 GMT
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17
    Response Headers
    Cache-control:private, max-age=0
    Date:Mon, 04 Feb 2013 06:25:33 GMT
    Expires:Thu, 19 Nov 1981 08:52:00 GMT
    Keep-Alive:timeout=5, max=100
    cclaerhout and Jake Bunce like this.

Share This Page