With effect from version 1.68 of Photonic, Picasa and Google Photos have two different types of shortcodes. This has been done to handle the new API Google has previewed for Google Photos in May 2018. Both modules display photos from the same source, but have different strengths and weaknesses. Please see the Google Photos page as well.
Using Photonic with simple parameters the gallery short-code can now be used to display albums and photos from Picasa:
The main switch for Picasa is the
type parameter. You also need to have a user id:
[gallery type='picasa' user_id='abc']
You can also control various skinning aspects of how the thumbnails are displayed.
Google Photos vs. PicasaWeb (🔗)
In its infinite wisdom Google announced the shutdown of its Picasa service in February 2016 in favour of Google Photos. However, until May 2018 the old Picasa API remained the only way to programmatically retrieve photos from Google Photos. As a result Photonic was compelled to use Picasa’s API. Then, in May 2018 Google announced the Google Photos API in “developer preview“, encouraging users to test it, but discouraging use of the same for production instances. The developer preview, while functional, has restrictions in terms of how many requests can be made per day (2500).
In the opinion of many, Google Photos in itself is a giant leap backwards:
- PicasaWeb had an easy way of telling you what the album ID was. When Google killed PicasaWeb, this was gone. I have gotten around this by providing a “Helper” for finding the IDs. You can go to Photonic → Helpers → Picasa, put in your user name, and get the IDs. Note that the same album has different IDs between PicasaWeb and Google Photos!
- PicasaWeb used to support a mode for “Limited” sharing. As long as it was still around, in PicasaWeb restricted albums created in Google Photos showed up as “Limited”, while the classical PicasaWeb option of “Limited, anyone with the link” also existed for the same album. This permitted you to use the
authkeyprovided by PicasaWeb. But now that PicasaWeb is fully gone, this option doesn’t exist. Google introduces something similar at first glance, wherein it generates a shortcode for an album that you can hand out. E.g. for one of my albums it gives me the link https://goo.gl/photos/TuWyKAdameiXTmdo6. Clicking on the link expands it out, but none of the details in the link help in the API. Moreover the shortcode cannot be expanded by the API without authentication! Try this link. For older albums created with PicasaWeb, the
authkeystill works, as shown on the Albums page.
- In perhaps the least thought out move, Google made it very, very hard to make an album public. In fact, there is no way currently to determine a user’s public albums in Google Photos – you only see the older PicasaWeb albums. There were certain third-party workarounds that let you make albums public, but those do not work any more either.
Which Module to Pick?(🔗)
For most purposes the Picasa module of Photonic does the job perfectly, though the code complexities require jumping through hoops in terms of the shortcode. But there are certain areas where Google Photos do better. You can use the following table for reference:
|Use Photonic’s Picasa Module if…||Use Photonic’s Google Photos Module if…|
Both the modules can coexist. As you can see in the demo pages I have got both Picasa and Google running. So you can start using Google Photos and transition slowly from Picasa without breaking anything on your site.
Note that the album ids are different between PicasaWeb and Google Photos for the same album. The shortcode structure is slightly different as well, so you cannot simply swap out
type='google' and expect it to work.
Also note that while Google hasn’t officially announced the date for phasing out the Picasa API, it will be phased out once the Google Photos API is more stable.
Obtaining a Client ID (🔗)
The older Picasa API didn’t require an API key except for viewing private photos. However the shift to Google Photos has made an API key almost mandatory. To get one:
- Go to the API Manager. You will see a screen like this:
- Note that the above screen will show up if you have an API Project already. If you don’t, you can create one using the instructions here.
- Now you need to get your client ID. For this, click on the “Create Credentials” button, and select “OAuth client ID”:
- In the resultant screen, pick the option for “Web application”, give it a “Name”, then fill out the “Authorised Redirect URIs”. You can get the Redirect URIs for your site from Photonic → Settings → Picasa → Picasa Settings → Google Client ID. If you also want to use the same Client ID for Google Photos, add the URLs listed under Photonic → Settings → Google Photos → Google Photos Settings → Google Client ID. The required URIs are listed there. You first put in one, hit enter, then put in the next and hit enter again.
- Once you are satisfied with your app, click “Create”. Google immediately gives you the credentials:
- Copy the information from the above to Photonic → Settings → Picasa → Picasa Settings → Google Client ID and Photonic → Settings → Picasa → Picasa Settings → Google Client Secret.
Back-End vs. Front-End Authentication (🔗)
In an attempt to overcome shortcomings of Google Photos’ sharing model, Photonic has baked in a nice little form of authentication. Traditionally Photonic had one option, to enable “Private Photos”. This presents a login box that looked like this:
Visitors to your site can then log in and see your photos.
The above is an example of “Client-Side Authentication”, or “Front-End Authentication”, and with the changes to Google’s API, this has some serious shortcomings:
- Because Google makes it nearly impossible to make photos public, even showing photos that you have no hesitation in making public creates quite a disruptive user experience, often requiring users to login.
- It assumes that your site’s visitors have Google logins, and have been added to your whitelist of who can see your photos. With the ubiquity of Google it is likely that most of your visitors have logins, but no level of omniscience can help you whitelist all your visitors.
Enter “Server-Side Authentication”, or “Back-End Authentication”, introduced in Photonic 1.59. This capability has the server authenticate you (rather than your visitors), then display photos that you are allowed to see (your own, or others’). Your visitors won’t have to login, and can see what you choose to share through your WP site.
In a nutshell, Client-Side Authentication lets your visitors see what they are authorized to see, and Server-Side Authentication lets your visitors see what you are authorized to see. Of course, you can use parameters such as
filter in your shortcode to restrict what is shown to your visitors.
Setting this up is a brief process with a few steps:
- The first step requires you to set the Google Client ID and Google Client Secret at Photonic → Settings → Picasa → Picasa Settings, the same as you would in the front-end mechanism.
- Next, head over to Photonic → Authentication → Picasa / Google Photos (Photonic → Helpers → Picasa / Google Photos Refresh Token Getter for Photonic versions older than 1.65), then start the authentication:
Clicking on the button will take you to Google’s website.
- Once you approve the application on Google’s website, you will need to obtain the token:
Click on the button, and Photonic will try to fetch the “Refresh Token” for you.
- Upon a successful execution, you will see the “Refresh Token”:
Copy this token, and paste it in Photonic → Settings → Picasa → Picasa Settings → Refresh Token (for Back-end / Server-side Authentication). Save, and you are good to go!
Once done, your albums will behave very much like the old Picasa albums with the exception of the
authkey support – that will be implemented in a later release; for now, visitors will see those albums unless you filter them out.
Note that the Server-Side authentication overrides the Client-Side authentication. So, if you have both activated (you shouldn’t, but just saying), your visitors will see whatever you are showing, not just what they are authorized to see.
For specific examples of using Server-Side authentication see the Picasa Albums page.
Creating a Google Project (🔗)
If you do not have a Google API project set up in the API Manager, follow these steps:
- Start off by clicking on the project selection link:
- Now, click on the “+” icon:
- On the resultant screen fill out a project name and click “Create”
That’s it. Your project will now appear in the project selection dropdown.