Photos

 

Photos from Flickr can be displayed using any arbitrary search criteria:

[gallery type='flickr' user_id='abc' view='photos']

The above displays 100 photos from the user’s photo-stream. It does the following:

  1. Displays thumbnails of each of the photos, with options to turn off the title and photo-count display.
  2. Each photo’s thumbnail can be clicked to launch a slideshow for the stream in display.

Photo Streams (🔗)

The following is an example displaying my photo stream (the count is restricted to 30 due to Flickr’s TOS):

You can add a few more parameters to the short-code to reduce the number of photos, or to get photos by a certain tag only:

[gallery type='flickr' view='photos' user_id='abc' tags='p,q,r' per_page='n' layout='random']

The accepted parameters are:

  1. tags – Comma-separated list of tags to filter the photos by
  2. tag_mode – Either ‘any’ for an OR combination of tags, or ‘all’ for an AND combination. Defaults to ‘any’ if not specified.
  3. text – A free text search. Photos whose title, description or tags contain the text will be returned. You can exclude results that match a term by prepending it with a – character.
  4. sort – The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc, date-taken-asc, date-taken-desc, interestingness-desc, interestingness-asc, and relevance.
  5. group_id – The id of a group whose pool to search. If specified, only matching photos posted to the group’s pool will be returned.
  6. user_id – The NSID of the user whose photo to search. If this parameter isn’t passed then everybody’s public photos will be searched. A value of “me” will search against the calling user’s photos for authenticated calls.
  7. per_page – Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  8. layout – This has nothing to do with Flickr, and is a Photonic attribute. You can use square, circle or random, and get an arrangement of square thumbnails, or circular thumbnails, or a random tiled gallery respectively.

Tags (🔗)

As you might have guessed, you can display photos by searching for tags using the tag attribute in the shortcode. You can see the usage here, where I have displayed 20 photos from my photo-stream tagged “calcutta” in a random layout:

[gallery type='flickr' user_id='35553131@N07' view='photos' per_page='20' tags='london' layout='random']

Search by Text (🔗)

Instead of using a tag as in the previous case, you can use a free-text search as well:

[gallery type='flickr' user_id='35553131@N07' view='photos' per_page='20' text='sydney' 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 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 Flickr the setting is under Photonic → Settings → Flickr → Flickr 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='flickr' view='photos' user_id='35553131@N07' per_page=10 media='videos']

The above shows the following:

  • Guitar innovation on a Saturday afternoon at Trafalgar Square
  • Crunch!

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.

Group Pools (🔗)

Similar to tags, photos belonging to a group pool can be displayed using the group_id attribute.

[gallery type='flickr' view='photos' group_id='16978849@N00' per_page=10]

“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 Flickr, use the per_page attribute and add an additional tag, more. This will initially show you the number of photos specified in per_page, and a button to load more images. Upon clicking the button you will see an additional set of photos as limited by per_page. The button will continue to show until you have exhausted the entire set of photos.
  2. Photonic can be used in conjunction with <!-- nextpage --> to display photos in a paged manner on WP posts (not pages, which don’t support pagination). For this you can structure your post content thus in the WP Editor:
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc porta enim vel tellus dignissim, a venenatis neque congue. Nunc ornare cursus leo ac viverra. Pellentesque suscipit pulvinar metus, non aliquam odio egestas quis. Vestibulum porta viverra magna, vel malesuada ante fermentum vitae.
    [gallery type='flickr' view='photos' group_id='16978849@N00' per_page=10 page=1]
    <!-- nextpage -->
    [gallery type='flickr' view='photos' group_id='16978849@N00' per_page=10 page=2]
    <!-- nextpage -->
    [gallery type='flickr' view='photos' group_id='16978849@N00' per_page=10 page=3]
    

Here is an example using the first approach. The text you provide to the more parameter controls what is shown in the button:

[gallery type='flickr' user_id='35553131@N07' view='photos' per_page='10' tags='sydney' layout='random' more='Load More']