Flickr galleries page slow load
-
collections_display=’lazy’I’m using this plug-in with my Flickr collections & albums. It displays them great- very nice job. I’ve noticed that with Flickr collections containing several albums, it takes a very long time to load the page.
Here’s an example:
https://www.grayphoto.us/football/I tried adjusting the Flickr Tile image size option to 320px on longest side, but it still takes a while to load. I’ve also used the collections_display=’lazy’ setting in the shortcode.
Is there anything else I can do to speed up the page load? Thank you.
The page I need help with: [log in to see the link]
-
Can you turn on performance logging (Photonic → Settings → Generic Options → Generic Settings → Performance logging)?
Note that neither the
collections_display
nor thetile_size
settings will take effect for you: you are not using Flickr collections (at least I don’t think you are), and thetile_size
is only effective for the Justified Grid, Masonry and Mosaic layouts.What shortcode do you have in place?
I turned on performance logging.
I’m using both Flickr Collections and Flickr Albums, depending on the page (so I use either collection_id or photoset_id)
For the Football page (https://www.grayphoto.us/football/) it should be using Collections. Here’s the shortcode for that page:
[gallery type='flickr' user_id='MYUSERID' collection_id='blahblahblah' collections_display='lazy']
For other pages, it only uses 1 Flickr Album, so that code would look like this:
[gallery type='flickr' user_id='MYUSERID' photoset_id='blahblahblah' collections_display='lazy']
Thanks.
For your second shortcode the
collections_display
attribute has no impact since you are not displaying a collection.For the first instance, even though you have set your
collections_display
to lazy it will have no effect because you are displaying an individual collection. Take a look at the documentation. Only when you are displaying multiple collections will this have an effect – basically the “lazy loading” introduces the “+” icon, which you then click to explicitly load the albums within the collection.Unfortunately if you are trying to load an individual collection directly this will cause a slowdown because of the reasons documented in the link above (i.e. it will automatically try to fetch all albums in the collection – lazy loading isn’t supported for individual collections). There is a potential solution for this via a code change, but I am a bit hesitant to put that in. Essentially right now calls to fetch the album information are made in sequence, and I can change them to be called in parallel. The issue with this, though, is that Flickr is a bit of a badass when it comes to API rate limiting. If you make multiple calls in one shot, it *might* sense this as an over-use of the API, and might impose rate-limiting. That in turn will start showing “Connection failure” errors on the front-end, which you certainly wouldn’t want.
A different approach might be to explicitly select which albums you want to show – that will employ just one API call and is significantly quicker. The downside is that if you explicitly name your albums, the call ceases to be dynamic, and each time you add a new album you have to manually edit the shortcode. Again, this is not optimal.
Maybe there is one thing you can do, though: fetch all collections, but apply a filter and do lazy loading. Essentially if you see the documentation example, I am doing this:
[gallery type='flickr' user_id='40600878@N08' view='collections' filter='72157627778919301,72157626225643420' collections_display='lazy' headers='title,counter']
Ordinarily
view='collections'
would fetch all collections, but then I have explicitly told Photonic to only show two collections usingfilter='72157627778919301,72157626225643420'
, and then I have setcollections_display='lazy'
. As a result, the albums under the collections will be fetched only if I explicitly click on “+”, thereby saving some time.One question: how are you generating the shortcode? Are you using the interactive workflow introduced as a part of release 2.00? The reason I ask is because if you were using the interactive workflow, it wouldn’t show you the “lazy” loading option to generate the second shortcode.
Unfortunately, I can’t explicitly select which albums I want to show because there are too many of them, and not having it load dynamically would defeat the purpose of my use for this.
I do have the most up-to-date version of the plug-in, but I think I came across the ‘lazy’ switch in a forum post and thought I’d give it a try.
It doesn’t sound like there are any fixes/workarounds to load the albums in the collection dynamically without it being slow. That’s a bummer…
How about the last example I provided above? Doesn’t that work for you? There you are just specifying collections explicitly, not the albums.
E.g. Instead of doing this:
[gallery type='flickr' user_id='MYUSERID' collection_id='blahblahblah']
Do:
[gallery type='flickr' user_id='MYUSERID' view='collections' filter='blahblahblah' collections_display='lazy']
I’m not sure if that would help. I have a page called ‘Sports’ (www.localgeek.us/sports) which displays the collections, but they’re not coming from Flickr- they’re just image links which then open the single collection pages (i.e., Basketball, Football, etc).
The issue I’m having is loading those single collection pages containing several albums.
It is likely that I am misunderstanding your requirement, but here is what I was suggesting. In your Football page you have this shortcode:
[gallery type='flickr' user_id='MYUSERID' collection_id='FOOTBALL_COLLECTION_ID']
Change it to this:
[gallery type='flickr' user_id='MYUSERID' view='collections' filter='FOOTBALL_COLLECTION_ID' collections_display='lazy']
That’s all. All your pages will remain as they are, and it doesn’t change the fact that your football collection has multiple albums. If you do it the above way, whenever you add a new album to the Football collection it will show up automatically.
The only difference between what you have now and what I am proposing that the albums won’t auto-load – they will load when you click on the “+”.
I tried this (see https://www.localgeek.us/footballtest).
It does load the albums faster- about 5 secs vs 15 secs using the old method. However, I’m not sure if having to click the “+” sign will be user-friendly for visitors. Is there any way to invoke an auto-load? Is that the code change you’re hesitant to use?
Correct – that is the code change I am hesitant to do. I can still put in the code change and make it some sort of an “opt-in”. That way people are informed that for collections with a large number of albums they might run a risk. Unfortunately that is the best solution I can come up with.
From my experience with different APIs, SmugMug handles nesting and parallelism the best. Flickr is pretty good across the board except for Collections. Zenfolio’s API is quite lacking in several features and is the worst with nested calls.
Is there any way to use a ‘tag’ to load the Flickr Albums instead of loading a Collection? I see that each Album has a Description text box, in addition to the Title. If this contained certain text (i.e., ‘football’), would you be able to read that and load all albums matching that text?
Flickr doesn’t support this in its API, and that makes things hard. Technically it is possible for me to fetch all albums and then scan through their descriptions and find the matching ones. The issue is that if you have a large number of albums they might not all come through in the call, and then I would have to do iterative searching, ergo repeated calls to the system. Also, for cases where Flickr’s API has search functionality it is quite comprehensive. But implementing similar functionality in a third party script always leaves something to be desired.
Given a choice between writing a custom search functionality and writing the code to do parallel calls I would prefer the latter.
If you’d like me to help test the parallel calls option, I’d be happy to. Thanks very much for a great plug-in.
@sayontan I saw a plugin called Justified Image Grid which claims to handle Flickr collections and nested/sub-collections. Are you familiar with this? Do you know if that one loads items in parallel like you mentioned?
I like the idea of making this an optional feature. Do you think this is something you’ll implement?
Thanks in advance.
I have already made the changes locally. I was in the process of testing some other Gutenberg-related changes, which is why I haven’t released this yet.
OK – I put the Gutenberg stuff on a hiatus for a while and restarted testing this.
I am able to now pull a pretty elaborate collection tree (3 collections with 47 nested albums) in around 3-5 seconds, but your collection tree takes time because of the larger number of collections. An individual collection comes across rapidly though. Let me see if I can optimize the pull for the whole tree, and I will release the code as soon as I am done testing.
- The topic ‘Flickr galleries page slow load’ is closed to new replies.