• Is there an optional shortcode parameter to only show albums with at least x number of photos in those albums? For example, I am looking for a way to show only albums with at least 20 or more photos in them. I am using Google Photos.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    I don’t believe any platform offers any such capability, not just via the API, but even via the front-end.

    Thread Starter maneshe

    (@maneshe)

    Would it be possible to add that functionality outside of the API call? Meaning do the filtering at the plugin level. So if the album contains less than x number of photos, the plugin would then not display the album.

    Plugin Author Sayontan Sinha

    (@sayontan)

    While technically possible, the main reason for not doing anything of this sort is performance. Google returns very few albums in each call. If you have a large number of albums, the code will have to sequentially fetch all albums and then apply any arbitrary filters not supported by the API. This step of fetching albums in multiple calls will significantly slow down the performance of your site.

    Thread Starter maneshe

    (@maneshe)

    I believe at least the Google API returns the number of photos in the album in the get album list request.

    See: https://developers.google.com/photos/library/reference/rest/v1/albums/list
    https://developers.google.com/photos/library/reference/rest/v1/albums#Album
    Look for mediaItemsCount.

    Using your plugin, with Google Photos, I am seeing the number of photos in each album already. It shows up right below the album title.

    Plugin Author Sayontan Sinha

    (@sayontan)

    I know how the API works… I was among the first adopters, and I contributed to it via several feature requests and bug reports in its early days, including one about the count of media items :-).

    It is true that the API returns the number of media items, but that is not the point I was contesting. Let’s say you have 500 albums. The first 200 of them have around 15 photos each, and out of the rest, some have more than 20 photos. When you query the API, your first call will get you the first 50 albums (not more – Google enforces a cap), but none of them will match your filter. So the plugin will have to make another call behind the scenes, and continue to do so until it gets to albums with 20+. This means, it will have to make 5 calls before it gets any results, since there is no way to change the sequence of albums. This is a process that will drastically affect performance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Filter by Number of Photos in Album’ is closed to new replies.