Support » Plugin: Responsive Lightbox & Gallery » TosRUs gallery has a major problem

  • When using the TosRUs gallery and using thumbnails as the pagination option, the “thumbnails” that are shown in the pagination are ALL using paths to the full-sized versions of the images.

    The images are displayed onscreen at 50×50, but the paths the images (which are background images) are actually the path to the full sized versions.

    This is obviously problematic for performance reasons, especially on mobile devices. To cite just one example, we have a gallery that has about 40 images in it, and each full sized image is approximately 1 to 2mb which makes for about a 60mb penalty just to display those tiny thumbnails in the pagination. That’s an expensive privilege.

    Ideally those thumbnails should be utilising the default WordPress thumbnail size of 150×150 at the most.

    I can’t see any obvious way (in the plugin settings interface) to specify the thumbnail dimensions, so how can this problem be resolved?

    • This topic was modified 2 weeks, 3 days ago by Michael Ott.
    • This topic was modified 2 weeks, 3 days ago by Michael Ott.
Viewing 1 replies (of 1 total)
  • Thread Starter Michael Ott


    Update: Looking at the JS it’s clear where the problem is, so I fixed it.

    Basically it’s currently grabbing the href value (which is pretty much always going to be the path of the large version of the image) and using it as the thumbnail path.

    How to fix:

    On line 473 of \assets\tosrus\jquery.tosrus.js change this…

    return c + t(this).data(s.anchor).attr("href") + h

    …to this…

    return c + t(this).data(s.anchor).attr("data-thumb") + h

    …and compile the file to minified jquery.tosrus.min.js

    Now in the actual gallery in the WordPress template, create an attribute on the anchor called “data-thumb” which contains a value of the path to the thumbnail version of the image, so your code is like this:

    <a href="path-to-large-image" data-thumb="path-to-thumbnail" rel="lightbox">
        <img src="path-to-thumbnail" />

    We’re running a forked version so have no problem making these kind of edits. But I believe the addition of a new attribute to solve this problem is a no-brainer.

    • This reply was modified 2 weeks, 3 days ago by Michael Ott.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.