Photos

Contents (🔗)

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' 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 album_id attribute:

 [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.

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 count=10 and layout='random':

[gallery type='google' view='photos' album_id='AKMhXYx3r1wLaa9Ue8T15uCMb4NZJaNkUTOSVyjH2VWPo61DWStYMzbC3GpCD51Znkb-eARpSlW7' count=10 layout='random' lazy_button='Execute Example']

Photos from a Shared Album (🔗)

If you want photos from a specific shared album you can use the short-code that you used for a regular album – it will work just fine:

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

But there is a secondary way to set this up, by using view="shared-photos":

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

While there is no difference between how the albums render on the front-end, Google distinguishes between these concepts, and consequently the second option is what works in the Gallery Wizard.

[gallery type='google' view='shared-photos' album_id='AKMhXYxIgQzFWwbP_9VA1uE0MHnR8SEXstnukYfrwoF19gKfnnMujS2_a9ksMAO8cidS8IUQ3SbYmXGapp8YkNA2PxaXBFfGhw' crop_thumb='crop' count='5' main_size='1600' thumb_size='150' layout='square']

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='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 lets you use the count attribute in conjunction with another attribute, more. The more attribute shows a button that a user can keep clicking until all the photos in that view are shown.

In the Gallery Wizard, this shows up in the screen Configure Your Layout as the option “More” button text.

Here is an example of the option in action:

[gallery type='google' view='photos' album_id='AKMhXYxmTsxFmsIJOAI3qZ0XM_kHlTf88PMQi0N770n1ZXJQhKyhH8o4qgJMPldgyLjHZuhnHrlh' count=10 layout='circle' more='Show More']