Photos

 

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 photos), and 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_filters attribute 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 Y/M/D where:
      • Y is 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/31 can 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.
      • M is 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/1 can be used to show the photos taken on the first of every month of 2018.
      • D is 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/0 will get you photos from June 2018. Correspondingly, 0/6/0 will get you photos from June from every year.
    • Ranges have to be specified in the format startDate-endDate where startDate and endDate are both in the date format as described above

    Ranges and dates can be combined together thus:

    • This will fetch all photos from June 2018:
      date_filters='2018/6/0'

      This uses the “0” for the date

    • This too will fetch all photos from June 2018, but using a range:
      date_filters='2018/6/1-2018/6/30'
    • 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:
      date_filters='2018/6/0,2018/2/0,2018/3/20-2018/3/31'
    • Five dates and ranges are allowed at any point of time.
    • Not passing this parameter means objects will not be filtered by date.
  • 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_filters shortcode attribute in this manner:

    • To include a single category:
      content_filters='CITYSCAPES'
    • To exclude a single category:
      content_filters='-SELFIES'

      Note the “-” in front of the category.

    • To combine inclusion and exclusion:
      content_filters='CITYSCAPES,TRAVEL,-SELFIES,-DOCUMENTS'
  • 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'] 

Photos from an Album (🔗)

If you want photos from a specific album you can use the above short-code but pass in the album_id attribute:

 [gallery type='google' view ='photos' album_id='abc'] 

Here are the photos from one of my albums:

To find the album_id you can use the helper provided with Photonic under Photonic → Helpers → Google Photos → Google Photos Album ID Finder.

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='AGj1epWtkTAxUGLLe7RovH0sUC6oO52WH8lQaZBH_RhUDA7WoLOG' count='m' columns='n'] 

This is one of my albums with count=10 and layout='random':

Videos (🔗)

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='AGj1epUJ_CPX6DO55rt-E6BLJjnXeCqo1gNmU1eQv1smj_gFN41Z' max_results=30 media='all']

The above shows the following:

  • Fire extinguishing vat at the Forbidden City
  • The long road ahead
  • Delicacies galore!
  • Crunch!
  • Teas(e)

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, Photonic offers a couple of approaches:

  1. For Google Photos, use the count attribute 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.
  2. 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 count and more attributes are the only way to paginate.

Here is an example:

[gallery type='google' view='photos' album_id='AGj1epXbbDWmjCXHH0Sko-s_7CJ-0Y9CbyBVT9LR_luBXFJ8F7MJ' count=10 layout='circle' more='Show More']