General Notes (🔗)
- For an overview of the layouts, see the Layouts page.
- Within Google Photos there is no provision to pass another user’s ID to see that person’s photos. The only way to see another person’s photos is if that person has shared an album with you. All photos shown on your Google Photos account will show up using Photonic.
- Working with albums on Google Photos requires you to authenticate first. Once authenticated you can use the code as documented in the following examples.
Displaying All Photos (🔗)
The following pulls my photos. The key parameters here are
view (set to
count (limits it to some instead of all photos):
[gallery type='google' view='photos' layout='random' count=30]
Filtering Photos (🔗)
The above display is fine, but it tends to mix up everything from your photos. What if you wanted to have more control over what you wanted to display? Enter Google Photos’ filters. Google Photos supports two types of filters – date and content:
- Date Filters
Date filters can be passed to Photonic for Google Photosusing the
date_filtersattribute of the shortcode. You can pass a comma-separated list of dates or ranges, assuming the following conditions are met:
- Dates have to be specified in the format
Yis the year and can be any value from 0 to 9999, both inclusive. Pass 0 if you want to ignore the year. E.g.
0/12/31can be used to show photos from New Year’s Eve celebrations from each year. You can use this to show photos from birthdays and anniversaries.
Mis the month and can be any value from 0 to 12, both inclusive. Pass 0 if you want to ignore the month. E.g.
2018/0/1can be used to show the photos taken on the first of every month of 2018.
Dis the date and can be any value from 0 to 31, both inclusive. Pass 0 if you want to pull photos regardless of the date. E.g.
2018/6/0will get you photos from June 2018. Correspondingly,
0/6/0will get you photos from June from every year.
- Ranges have to be specified in the format
endDateare both in the date format as described above
Ranges and dates can be combined together thus:
- This will fetch all photos from June 2018:
This uses the “0” for the date
- This too will fetch all photos from June 2018, but using a range:
- This uses a combination of dates and ranges and will fetch photos from February 2018, all photos taken between 20th and 31st March 2018, and photos from June 2018:
- Five dates and ranges are allowed at any point of time.
- Not passing this parameter means objects will not be filtered by date.
- Dates have to be specified in the format
- Content Filters
Google defines a list of categories for its photos:
- LANDSCAPES – Media items containing landscapes.
- RECEIPTS – Media items containing receipts.
- CITYSCAPES – Media items containing cityscapes.
- LANDMARKS – Media items containing landmarks.
- SELFIES – Media items that are selfies.
- PEOPLE – Media items containing people.
- PETS – Media items containing pets.
- WEDDINGS – Media items from weddings.
- BIRTHDAYS – Media items from birthdays.
- DOCUMENTS – Media items containing documents.
- TRAVEL – Media items taken during travel.
- ANIMALS – Media items containing animals.
- FOOD – Media items containing food.
- SPORT – Media items from sporting events.
- NIGHT – Media items taken at night.
- PERFORMANCES – Media items from performances.
- WHITEBOARDS – Media items containing whiteboards.
- SCREENSHOTS – Media items that are screenshots.
- UTILITY – Media items that are considered to be utility. These include, but aren’t limited to documents, screenshots, whiteboards etc.
You can pass these to Photonic using the
content_filtersshortcode attribute in this manner:
- To include a single category:
- To exclude a single category:
Note the “-” in front of the category.
- To combine inclusion and exclusion:
- Date and content filters can be combined in the same shortcode.
The following gets my from February 2018, all photos taken between 20th and 31st March 2018, and photos from June 2018:
[gallery type='google' view='photos' date_filters='2018/6/0,2018/2/0,2018/3/20-2018/3/31' thumb_size='104']
The following filters the above dataset further:
[gallery type='google' view='photos' date_filters='2018/6/0,2018/2/0,2018/3/20-2018/3/31' content_filters='cityscapes,-TRAVEL' thumb_size='104' count=100]
Photos from an Album (🔗)
If you want photos from a specific album you can use the above short-code but pass in the
[gallery type='google' view ='photos' album_id='abc']
Here are the photos from one of my albums:
[gallery type='google' view='photos' album_id='AKMhXYx3r1wLaa9Ue8T15uCMb4NZJaNkUTOSVyjH2VWPo61DWStYMzbC3GpCD51Znkb-eARpSlW7' count=100 thumb_size='104']
To find the album_id you can use the helper provided with Photonic under Photonic → Helpers → Google Photos → Google Photos Album ID Finder. With effect from version 2.00 you will not require the “Helpers” if you use the “Add / Edit Photonic Gallery” button to insert your gallery.
Note that legacy Picasa albums that have an
authkey protection lose such protection with the Google Photos API. If you still wish to use the protection you have to use the Picasa module.
You can add further constraints such as the number of photos and the number of photos per row:
[gallery type='google' view='photos' album_id='AKMhXYx3r1wLaa9Ue8T15uCMb4NZJaNkUTOSVyjH2VWPo61DWStYMzbC3GpCD51Znkb-eARpSlW7' count='m' columns='n']
This is one of my albums with
[gallery type='google' view='photos' album_id='AKMhXYx3r1wLaa9Ue8T15uCMb4NZJaNkUTOSVyjH2VWPo61DWStYMzbC3GpCD51Znkb-eARpSlW7' count=10 layout='random' lazy_button='Execute Example']
What if you had some videos in the mix? Photonic can handle that too. I have the philosophy that Photonic is meant for photos, not videos, because Photonic’s primary goal is to assist in making photos easily and beautifully presented for photographers using WordPress. In fact most online photo services deprioritize videos with the same philosophy, and some services don’t even have videos! At the time of writing 500px.com doesn’t have videos, and guess what? Native WordPress galleries don’t support videos! That being said, people often use photo services, notably Google Photos, to share personal videos with family, and so, with effect from version 1.66 of Photonic, videos are supported.
Videos are turned off by default for each provider. For Google Photos the setting is under Photonic → Settings → Google Photos → Google Photos Settings → Media to show. Regardless of this setting, you can explicitly pass the
media parameter to your shortcode. This parameter takes values
photos (to show photos only),
videos (to show videos only) and
all (to show both photos and videos). I have videos turned off on my website, so I will use the
media parameter to show videos from my account:
[gallery type='google' view='photos' album_id='AKMhXYxzGTH2YSebee-Y9MCM_stFT_nl8QZGCJAAVq5JkaD6w5UYEfPNypkxP37tvazEn7bzCv0d' count=30 media='all']
Note that lightboxes have notoriously flaky support for externally hosted videos. Please refer to the lightboxes page to see which ones can be used.
Videos can be incorporated into any layout.
“Show More” and Paged Results (🔗)
If a search result has a lot of photos and you want to reduce the count, or if you have more photos than Google’s API can return (i.e. if you have more than 100 photos in an album), Photonic offers a couple of approaches:
- For Google Photos, use the
countattribute documented above, and add an additional tag,
more. This will initially show you the number of photos specified in
count, and a button to load more images. Upon clicking the button you will see an additional set of photos as limited by
count. The button will continue to show until you have exhausted the entire set of photos.
- Unlike most other providers Google Photos does not support pulling specific pages of photos, and using specific filters as documented in the first section in conjunction with the
moreattributes are the only way to paginate.
Here is an example:
[gallery type='google' view='photos' album_id='AKMhXYxmTsxFmsIJOAI3qZ0XM_kHlTf88PMQi0N770n1ZXJQhKyhH8o4qgJMPldgyLjHZuhnHrlh' count=10 layout='circle' more='Show More']