Developer info

Last updated on
30 April 2025

This documentation describes the latest stable D7 version of the Flickr module.

TODO: Write some lines on the caching mechanism.

Getting debug info for albums using Devel

  • Enable the Devel module.
  • Enable devel setting in Flickr module settings.
  • Re-save the node or block you have trouble with.
  • Look at the argument values that are passed to the Flickr API request.
  • To disable, comment the dpm() by putting a double slash in front of it, save and disable Devel.

The debug info can be used in the API Explorer that you find at the bottom of an API method of choice. For example the photos for a user album are returned by flickr.photos.search. The corresponding API Explorer allows you to insert the debug info and see what is returned by Flickr. After selecting ' Do not sign call?' click the 'Call method' button.

TO DO: Include used API method in debug info.

 
An album shows not the photos as before while nothing has been modified
Occasionally a bug depends on a (temporary) malfunction of the Flickr API. An album on your site was working fine before, you made no changes but now it does not show the photos you would expect. If you are pretty confident that's the case and the API Explorer returns wrong results as well (see above), add the issue to an existing topic in the Flickr API group or open a new one. An example. Just for the purpose of informing other users, open an issue on Drupal as well and link to the the topic on Flickr. An example: #2286823: Zero results when using tags (Flickr API bug).

Image HTML structure

An embedded image using the Flickr module is structured as follows (an example using Colorbox and AutoFloat):

Part 1: Starts the wrapper and the link to open when clicking on the image (Colorbox). Generated by theme_flickr_photo() in flickr.module:

<span class="autofloat-even flickr-wrap">
  <a href="https://farm8.static.flickr.com/7417/9247388074_8b94303cc5.jpg" title="Photo description." class="colorbox rel="gallery-all" target="_blank">

Part 2: The image itself. Generated by theme_image() in /includes/theme.inc, called by flickr_img() in flickr.inc, called by theme_flickr_photo() in flickr.module:

    <img class=" flickr-photo-img" src="https://farm8.staticflickr.com/7417/9247388074_8b94303cc5_q.jpg" alt="Photo title" title="Photo title.">

Part 3: The caption and closing tags. As part 1 generated by theme_flickr_photo() in flickr.module:

  </a>
  <span class="flickr-credit" style="width: 231px;">
    <a href="https://www.flickr.com/photos/98518260@N02/9247388074" title="View on Flickr. To enlarge click image." target="_blank">
      <span class="flickr-title">Photo description.</span><br>
    </a>
    <span class="flickr-metadata">2 years ago at <a href="https://www.flickr.com/photos/98518260@N02/map?&amp;location=Al `Aqabah, Jordan" title="View photo on Flickr map." target="_blank">Al `Aqabah, Jordan</a> by <a href="https://www.flickr.com/photos/98518260@N02" title="View user on Flickr." target="_blank">Flickr user real/username</a>
    </span>
  </span>
</span>

Note that the function theme_flickr_photo() is called for example as theme('flickr_photo', array('photo' => $photo, 'size' => $size)) from any function that generates Flickr media to display in blocks, the node body, a field or a set (respectively the sub-modules Flickr Block, Flickr Filter and Flickr Field, Flickr Sets). If multiple images should display, you'll probably find it wrapped in a foreach loop.
 
Other modules that extend the Flickr module can easily plugin on this.
 

Album HTML structure

<div class="flickr-photoset"><p class="flickr-album-heading">Flickr photos tagged <span class="flickr-tags">flowers and red</span> </p>
<div class="flickr-album">
[...images, see above...]
</div>
<div class="flickr-album-counter">8 out of 20 <a href="https://www.flickr.com/search/?sort=relevance&amp;text=flowers red" title="Tagged flowers and red." target="_blank">on Flickr</a></div></div>

Albums are generated by one function only that can be found in flickr.inc:
function flickr_album($type = 'user', $id = '39873962@N08', $show_n = NULL, $size = NULL, $media = 'photos', $tags = '', $tags_user = '', $delta = 'true', $sort = 'unsorted', $heading = 'p', $min_title = NULL, $min_metadata = NULL, $vocab_isset = 0, $filter = NULL, $lat = NULL, $lon = NULL, $radius = NULL, $datefrom = NULL, $dateto = NULL, $extend = 1, $tag_mode = 'context', $class = NULL, $style = NULL, $page = 1)
Arguments to pass:
$type : 'user', 'group', 'photoset', 'gallery' or 'favorites'.
$id : NSID on Flickr for a user, group, gallery or photoset. The default ID '39873962@N08' is returned by function flickr_user_find_by_identifier($identifier) on an empty $identifier in flickr.inc. Also 'public' is an accepted value that grabs CC licensed public photos.
$show_n : The number of photos to display.
$size : The size to display. The usual Flickr suffixes, plus 'x' and 'y' for the full featured and basic slideshows. To be passed to theme_flickr_photo() (see above).
$media : 'all', 'photos' or 'videos'. The default is always 'photos' as the Flickr service is most indicated for images and most site builders prefer YouTube to embed videos.
$tags : Flickr tags to filter on, in most cases taken dynamically from node terms.
$tags_user : Flickr tags tied to a specific user account to Filter on. This way a user can use only specific photos from an existing Flickr account to be embedded.
$delta : Numeric ID of the Flickr Block sub-module. In case of a request for an album from the Flickr Fliter sub-module, it is TRUE or FALSE and (ab)used to indicate if we want to display a counter under the album or not. For a photoset on a user profile it is set to 101 to make sure it is cached. Only a numeric $delta (usually a block) is cached as nodes (Flickr Filter) have their own caching.
$sort : 'random', 'recent' (reverse chronological, newest first) or 'views' (number of photo views on Flickr, descending thus a measure for the popularity).
$heading : The HTML tag to wrap around the album title (usually 'p','h2' or 'h3'). The value 'none' is used to suppress the album title completely.
$min_title : A 3 digit value in pixel. Displays the title in the photo captions for images above this width. A value of 0 always displays the title, while a value of 999 always suppresses it. To be passed to theme_flickr_photo() (see above).
$min_metadata : A 3 digit value in pixel. Displays the metadata in the photo captions for images above this width. A value of 0 always displays the metadata, while a value of 999 always suppresses it. To be passed to theme_flickr_photo() (see above).
$vocab_isset : Contains the numeric vocabulary ID. So if != 0, we know that a vocabulary is set. It is only used to recognize the situation that a vocabulary is set to filter on, but no tags (terms on the node) are available. A message 'Post has no Flickr tags specified' gets displayed.
$filter : Possible values: empty, 'relevance' or 'interestingness-desc'.
$lat : Latitude in decimal (e.g. 48.867556) or DMS format (e.g. 48° 52' 3.2016").
$lon : Longitude, idem.
$radius : Radius around GPS coordinates to cover an area (in km). Use a dot for the decimal.
$datefrom : A start date with many accepted date formats (e.g. '11 Jan 2015'), also a relative format (e.g. 'first day of last month'). In any case it will be converted to YYYY-MM-DD HH:MM:SS where 00:00:00 is appended as the time to start at the first second of the day.
$dateto : An end date, idem. Optional even if a start date is given. In that case the end date = start date. 23:59:59 is appended as the time to end at the last second of the day.
$extend : false or true. Extend the tag filter to search for matching terms also in the Flickr photo title and description besides Flickr tags.
$tag_mode : Matches all defined tags (AND) or any (OR).
$class : Syntax as in HTML. Wrap the value in quotes (or not) and put spaces between multiple classes. Applies to the outer HTML element of a photo or album.
$style : Syntax as in HTML. Wrap the value in quotes (or not) and put semicolons between different style declarations. Applies to the outer HTML element of a photo or album.
$page : Default value: 1 (first page of results). It is altered for a random sort order to extend the randomness to all photos instead of only the last batch. It is also used by a pager (currently only for a photoset on a user profile page).
 

Used Flickr API requests.

Flickr API Documentation
The Flickr module uses XML-RPC to connect to Flickr's API and retrieve photo information.

TODO: Put it in table form to show what module functions use which API requests.

In order of appearance in flickr.api.inc.

 

Simplify Flickr Field.

Those that are using Flickr Field exclusively to add photosets to a post (no single images) could modify it to consist only of the field to submit a Flickr set ID (see images below, before and after modification).
BEFORE  AFTER
The necessary code has been put in a custom module to be extracted in the module folder 'flickr'. You'll find it in the 'Flickr' module section at ../admin/modules.
NOTE: Only works with the latest version of the Flickr module.

Taken from #2416565: flickrfield should be available to alter sub fields..

Help improve this page

Page status: Not set

You can: