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’s current Google Photos doesn’t have a public API, and the old Picasa API remains. As a result Photonic is compelled to use Picasa’s API. In the opinion of many, Google Photos is a giant leap backwards:
- Unlike PicasaWeb there is no easy way to determine the ID of an album. I have gotten around this by providing a “Helper” for it. You can go to Photonic → Helpers → Picasa / Google Photos, put in your user name, and get the IDs. To get the IDs of Google Photos albums you will need to authenticate.
- 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. I can visit the link, which expands 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 are certain third-party workarounds that let you make albums public, but the process is very convoluted.
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. 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.