• Resolved Peter Odryna

    (@podryna)


    I am using Photonic with Google Photos which connected properly. Album selection shows an initial list, and if I select 1, 3, or many albums they display properly. However, if the album desired is not in the initially loaded list, then the LOAD MORE button is used to shows additional albums. Any albums selected will not display.

    Similar behavior observed if first LOAD MORE is used multiple times to load them all, and then the search is used to search for a subset of albums, any album that was not displayed in the initial list cannot be displayed.

    All software is on the latest revision as of the date of this post.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Peter Odryna

    (@podryna)

    FYI, I have more than 100 albums in Google Photos and need to use LOAD MORE more than once to see them all.

    Plugin Author Sayontan Sinha

    (@sayontan)

    There is a setting for this: Photonic → Settings → Google Photos → Chain queries. This setting is explicitly meant for this requirement.

    Thread Starter Peter Odryna

    (@podryna)

    Thanks, that worked. I can now select albums in the LOAD MORE area. Curious why that isn’t on by default as it would be the expected behavior. It doesn’t seem to slow down anything.

    Plugin Author Sayontan Sinha

    (@sayontan)

    It actually slows things down, and quite significantly, depending on the number of albums you have.

    Behind the scenes, the code invokes web-service calls in a sequential manner. There is no way to make the calls in parallel, as Google doesn’t have a way to paginate the data; rather Google provides a “token” with each page, which you have to use to retrieve the next page.

    If you have a large number of albums (> 500), this can add a hefty load time. E.g. in your case, your page currently loads in ~3s at my end. A lot of this actually goes into the round-trip call to Google. From what I can remember with my initial testing, with each additional call to Google, this increases by about 0.7s.

    There is another facet – rate-limiting and quotas. Google has rather aggressive and low quotas, and each time you fetch a new page, it counts towards your quota usage. Combined with the fact that each page reload, and fetching each photo also counts towards your quota, this becomes a problem for many users.

    Thread Starter Peter Odryna

    (@podryna)

    I had a hunch this was the case. It sounds like this impacts visitors as well when they view photos (which was the real goal, not needing to download and upload album contents). Does the quota hit when visitors are at the site viewing photos? And does the PHP vs. JS options change this at all?

    Also is there in option when you retreat all albums to specify a sort order? Most recently modified would most likely put the ones desired at the top of the list. I use that sort in Google Photos.

    Plugin Author Sayontan Sinha

    (@sayontan)

    Does the quota hit when visitors are at the site viewing photos?

    Yes. Google has 2 types of quotas – an API call quota (10,000 per day), and a media access quota (75,000 per day). What I am referring to hits the first type. Now, if you display an album and show 100 photos from it, that counts as one API call (for fetching the album) and 100 media access calls. But if you display a group of albums, you only invoke the API call quota upon page load. For your scenario, there might be 2-3 API calls with each page refresh. When you explicitly click on one of the album thumbnails, that’s an additional API call per album clicked, plus the calls for all the media items in it. Unnecessarily complex – I know.

    And does the PHP vs. JS options change this at all?

    No. The JS option is often preferred if you want your page to load faster. It gets you better scores for time-to-first-byte and quite a few other SEO metrics… but it loses you points if your photos are above the fold and cause a “Cumulative Layout Shift”. I have optimized things to the extent possible, but I periodically revisit these to make improvements (e.g. this one is in my to-do: https://wordpress.org/support/topic/mosaic-layout-under-fireofx/).

    The PHP mode is preferred if you have caching enabled (which you cannot do with Google Photos – their URLs are non-cacheable). It also gets you searchable content, since your page’s content is all coming from the server (unlike the JS mode, where some of the content is coming from the front-end via AJAX).

    For Google Photos, JS mode is the way to go. For other platforms, it is your call based on the advantages and trade-offs that I mentioned above.

    Also is there in option when you retreat all albums to specify a sort order? Most recently modified would most likely put the ones desired at the top of the list. I use that sort in Google Photos.

    I deliberately don’t offer options that are not natively supported by the API. This keeps the focus on performance. There are rare cases when I go beyond this, e.g. the “query chaining” feature above (mainly instituted because Google will not let you pull more than 50 albums in one go, unlike Flickr or SmugMug), or for Zenfolio, whose API is too useless to do anything meaningful.

    Google’s API doesn’t offer any option to sort. The feature might be there in their app or website, but their API doesn’t have it. Though it might seem trivial, sorting for Google Photos is one of the worst nightmares if you have more a large number of albums. Basically, I will have to do the query chaining to first pull all the albums, then run a sort, then paginate.

    Thread Starter Peter Odryna

    (@podryna)

    Excellent answers, thank you. I’ve been the CTO of several companies and in developing websites and both implementing and using APIs, I share your frustrations in limitations or poorly implemented options. I noted the way you are using AJAX and couldn’t see anything to improve upon. You clearly know what you are doing and what you are up against. I now understand why most photo plugins opt for uploading photos to create albums vs. using the native album APIs offered by online photo systems.

    Since my use of these photos are all personal and low traffic, I don’t expect that Ill be running into API limits. Leaving the albums in Google Photos is mostly for convenience so that I don’t have to maintain two albums for each photo set.

    It’s amazing how much effort you have put into Photonic. I’m glad you have done so and thank you again for your contribution.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Album selection in Google Photos fails when LOAD MORE is needed.’ is closed to new replies.