• Resolved ghislainsc

    (@ghislainsc)


    Hello David and thank you for the great plugin,

    I am trying to build a searchable image database. Thanks to the very complete documentation it all went quite fast. You can check the result here:

    https://brand.noboedu.com/media/
    (id: demo, pw: demo, you can search “2016” to find the test images)

    Now I wanted to style the page with a masonry style, so I used column-count and column-gap to that. But this CSS style actually loads the images from top to bottom which results in a very chaotic loading.

    To prevent this problem I installed the plugin “Dominant Colors Lazy Loading” which replaces the image with a color frame (svg) before it loads. The plugin works well with regular wordpress galleries and regular images, but doesn’t work with mla gallery. Then I used “mla_alt_shortcode=gallery” but it still didn’t make the trick.

    You can see the plugin in action on this other page: https://brand.noboedu.com/test-gallery/

    Interesting enough you will see that this test page has 4 galleries, #1 is a regular wordpress gallery, #2 and #3 is a mla gallery with “mla_alt_shortcode=gallery”, #4 is a mla gallery without anything else. Still ALL the images of ALL 4 galleries lazy load well using the plugin. But if I remove the regular gallery from the page, then the images from the mla galleries won’t lazy load.

    I’ve been searching the documentation of both plugins all night and tried countless test. I thing masonry layout and lazy load would look really cool with the mla gallery. If you have any idea why this doesn’t work that would be wonderful. Otherwise I’ll just give up on the layout and style the page differently.

    Thank you again for the plugin.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for the good words about MLA and your application. I am traveling and away from my test/development system until next Thursday but I can investigate your report when I return.

    I found Dominant Colors Lazy Loading by manuelwieser in the Repository; is that the plugin you are using?

    Thanks for your understanding and your patience.

    Thread Starter ghislainsc

    (@ghislainsc)

    Hi David,

    Thank you very much for your reply.
    Yes, this is the right plugin and I haven’t made any progress so far.

    Thank you.

    Plugin Author David Lingren

    (@dglingren)

    Thank you for your patience while I’m on the road. I was able to do some preliminary investigation and have identified the process that Dominant Colors Lazy Loading (DLCC) uses to process the [gallery] shortcode.

    DLCC uses a WordPress function, get_post_galleries(), to scan the content of a post/page for the [gallery] shortcode(s), expand them and return an array of the image URLs they contain. DLCC uses the image URLs to lazy-load, etc.

    When you have an actual [gallery] shortcode in the body of a post/page, everything works well. However, when you have [mla_gallery alt_ids_shortcode=gallery] WordPress does not recognize the “gallery” portion and cannot build the list of URLs that DCLL needs.

    Sadly, when a post/page does not contain any [gallery] shortcodes WordPress does not have a filter that MLA could hook to build the URL list and add it to the list returned by get_post_galleries(). However, if you simply add a [gallery ids=0] shortcode (which never returns any items of its own) you can get WordPress to call a filter MLA could hook to supply the information DCLL needs.

    If adding the empty [gallery ids=0] shortcode will work in your application I believe I can build a small custom plugin to hook the filter and build the URL list. I haven’t been able to completely test that approach but it looks promising.

    Let me know if that works for you and I can pursue a solution when I’m back home.

    Thread Starter ghislainsc

    (@ghislainsc)

    Hello David, and thank you very much for finding the time to answer.

    I added the [gallery ids=0] to the page but it did not change anything. However if I have [gallery ids=1,2,3] and [mla_gallery ids=1,2,3,4,5] on the same page, then pictures 1,2,3 will lazy load with on both the standard gallery AND the MLA gallery, while picture 4 and 5 won’t lazy load. So it seems that individual pictures need to be hooked. I also asked a question to the developer of DCLL and I will see if he has some advice on this.

    I also wanted to share that I have successfully made MLA and WPDM (Download Manager) work together. Since WPDM creates a page like “www.domain.com/download/’filename'” to manage the download, I used the templates to make a custom field within MLA. I named it wpdm_link and it generated the download link for all the items. Then I replaced the gallery href tag with mla_link_href to redirect users to the download page.

    The added benefit is that WPDM allows me to have stats about the downloads, including stats for each user, and also to limit the number of downloads per user per week (even though more advanced user could still get around the download page and directly access all the media files). I think this could be very useful for many users, especially as WPDM has a “sell” feature.

    Thank you very much again.
    Ghislain.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the confirmation that adding [gallery ids=0] to the page is acceptable. Thanks as well for your additional remarks regarding the combination of MLA and WPDM; very interesting.

    To be clear, the [gallery ids=0] will only solve your problem if used in combination with the “small custom plugin” that I have yet to develop. I will work on this new plugin as quickly as I can. You wrote “So it seems that individual pictures need to be hooked.“, which is exactly what the custom plugin will do.

    I hope that makes sense. I will post an update here as soon as I have progress to report.

    Thread Starter ghislainsc

    (@ghislainsc)

    Hi David,

    Thank you very much. I amazed at how well you support this plugin.

    Thanks a lot.
    Ghislain

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20161029 that contains the fix. To get the Development Version, follow the instructions in this earlier topic:

    Shortcode not working in (special) widget

    After you install the Development Version you can easily install the example plugin. Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. You will see a submenu that lists all the example plugins and give you a “one-click” action for installing them.

    You are looking for “Get Post Galleries Example” plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” rollover action, then go to the WordPress Plugins/Installed Plugins submenu and activate it as you would any other plugin.

    Once that’s done you should get the proper lazy loading behavior for items displayed by [mla_gallery]. Note that you may need the [gallery ids=0] placeholder shortcode (as described above) to trigger the process.

    It would be great if you can install the Development Version and the new example plugin and let me know how they work for your application. Thanks again for your patience and your interest in MLA.

    Thread Starter ghislainsc

    (@ghislainsc)

    Hi David,

    Thank you very much. I followed your instructions and…

    It works fantastically well. It looks great, it’s very quick and the page loads instantly.

    I didn’t even need to include [gallery ids=0]

    I will keep the demo demo account for few more weeks, so you can check. I’ll have to disable it after launch, but if you want I can make you a more secure account after that.

    Thank you very much once again.
    Ghislain.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.40, which includes the “Get Post Galleries Example” plugin developed for this topic.

    I am marking this topic resolved, but please update it if you have any problems or further questions about the example plugin or “Dominant Colors Lazy Loading” support.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Lazy load and masonry layout’ is closed to new replies.