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 Sunando Roy’s 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 Sunando’s photo-stream tagged “calcutta” in a random layout:

[gallery type='flickr' user_id='57549557@N07' view='photos' per_page='20' tags='calcutta' 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='57549557@N07' view='photos' per_page='20' text='china' layout='random']

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='57549557@N07' view='photos' per_page='10' tags='calcutta' layout='random' more='Load More']