Support » Plugin: Photonic Gallery & Lightbox for Flickr, SmugMug, Google Photos, Zenfolio and Instagram » If you are getting an “Invalid Argument” error with Google Photos …

  • ResolvedPlugin Author Sayontan

    (@sayontan)


    Google made an unannounced change to its Photos API on 29th or 30th August, wherein it changed the maximum number of photos returned in a single API call to 100 from 500.

    Unfortunately this is a breaking change – if you pass a number > 100 the API returns an error … and this affects Photonic. Photonic by default displays the maximum permissible number of photos or albums to minimize API calls, so if you don’t pass a count or photo_count parameter to the shortcode, it will default the value to 500. As a result of this a shortcode that was working until 29th August might now not work. To remedy this you have two options:

    1. Go to the file wp-content/plugins/photonic/extensions/Photonic_Google_Photos_Processor.php, line 52. You will see this:
      'count' => 500,

      Change it to this:
      'count' => 100,

      Save the file, and all your shortcodes will be fine now.

    2. If you are uncomfortable making the code change above you can explicitly define the count=100 attribute on shortcodes for Google Photos. This will take a bit more effort on your part, but will be just as effective.

    Why am I not releasing this fix myself? I am about 75% done with some big changes to the plugin, so I don’t want to release the above as a patch and disrupt something else unwittingly.

    It has been included with the next version of the plugin though, so the next time you update the plugin your change will not be lost.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You are a prince among humans.

    We just noticed the problem on watercolordc.com and I fussed around w/it as an authentication-related error, since we’d recently moved the site (but not that recently) from a test domain to production. That didn’t work.

    Googled the error message and this post came up on top. Google Photos taketh away, and Google Search giveth.

    Thanks for the quick fix. The code change worked perfectly.

    Thank you, this fix worked well.

    You soooo kind ! Thank you for fix !

    Any chance that the next update you are working on can work around this limitation? maybe a pagination option that indirectly make new api calls for on every page click.

    BTW – does this google update have any impact on page load, especially on mobile devices? I have began to notice slow page load on mobile devices.

    Thanks

    Plugin Author Sayontan

    (@sayontan)

    @foley2013,
    While that is not difficult to do, I will not be doing it for two reasons:

    1. It is undesirable to bypass system restrictions in such a manner, particularly when nowhere in the rest of the plugin have I attempted to bypass any restrictions imposed by the provider. This can lead to unintended consequences for you on the part of Google, because it will be your API key associated with the calls.
    2. Google specifically imposes rate limiting on API calls, and putting in such an automated feature will rapidly eat into your API usage quota. When that happens, your users will stop seeing any photos for the rest of the day, after which the quota will reset.

    I am not aware of any performance impact due to this change by Google. I have observed no difference.

    Plugin Author Sayontan

    (@sayontan)

    The fix outlined in my original post above has been applied in version 2.00 of the plugin.

    Can you help me understand better please…

    If my album has more than 100 items, then it will only show those 100 items per day and no more correct?

    If yes, Is there any workaround I can use legitimately for Google Photos & your plugin, or is not?

    Thank you

    Plugin Author Sayontan

    (@sayontan)

    If my album has more than 100 items, then it will only show those 100 items per day and no more correct?

    No, that is not what Google changed. You can still use the more parameter of the shortcode as documented here, and it will show you a button to load more photos. The only thing that Google changed is that it reduced the number of photos you can show in one shot (not one day) from 500 to 100.

    Moderators: Requesting you to lock this topic, please, as I had intended this as a PSA and the proposed change has been made to the code base as documented above.

    • This reply was modified 6 months, 1 week ago by  Sayontan.

    Ok thanks. Can you remind me how many photos can be shown in 1 day maximum then?

    Thanks

    Plugin Author Sayontan

    (@sayontan)

    There is no such limit defined – all that is limited is the number of calls made using your API Key (2500 for now), which is measured by the number of shortcodes you are using multiplied by the the number of times each of those pages with the shortcodes is loaded.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘If you are getting an “Invalid Argument” error with Google Photos …’ is closed to new replies.