You are here

function flickr_album_link_construct in Flickr 7

Create a link to a Flickr search page with similar results as a user or group album passing the same arguments.

1 call to flickr_album_link_construct()
flickr_album in ./flickr.inc
Render multiple photos as an album.

File

./flickr.inc, line 1633
The Flickr API functions.

Code

function flickr_album_link_construct($linktext, $type = 'user', $id = '39873962@N08', $show_n = NULL, $media = 'photos', $tags = '', $filter = NULL, $lat = NULL, $lon = NULL, $radius = NULL, $datefrom = NULL, $dateto = NULL, $extend = 1, $tag_mode = 'all') {
  if ($extend == 1) {
    $tagsinurl = $tag_mode == 'all' ? str_replace(',', '+AND+', $tags) : str_replace(',', '+OR+', str_replace(',-', '+AND+-', $tags));
    $tags2 = '&q=' . $tagsinurl;
  }
  else {
    $tags2 = '&tags=' . $tags;
  }
  if ($type == 'user') {
    $link_id = $id == '39873962@N08' ? 'user_id=' : 'user_id=' . $id;
  }
  else {
    $link_id = 'group_id=' . $id;
  }

  // Avoid empty gps attributes in the query that causes Flickr query hickups.
  $link_lat = empty($lat) ? '' : '&lat=' . $lat;
  $link_lon = empty($lon) ? '' : '&lon=' . $lon;
  $flickr = l($linktext, 'https://www.flickr.com/search/?' . $link_id . '&per_page=' . $show_n . '&tag_mode=' . $tag_mode . $tags2 . $link_lat . $link_lon . '&radius=' . $radius . '&min_taken_date=' . $datefrom . '&max_taken_date=' . $dateto . '&sort=' . $filter . '&media=' . $media, array(
    'attributes' => array(
      'title' => t('View the results on Flickr'),
      'target' => '_blank',
    ),
    'html' => TRUE,
  ));
  return $flickr;
}