You are here

function theme_flickr_flickrcomslideshow_simple in Flickr 7

Theme Flickr set/user/group photos as an embedded Flickr.com slideshow ('size' = y).

3 theme calls to theme_flickr_flickrcomslideshow_simple()
flickr_album in ./flickr.inc
Render multiple photos as an album.
flickr_block_photosets in block/flickr_block.module
Photoset block. Block delta: 1 and 4.
theme_flickrfield_formatter_photoset_flickrcomslideshow_simple in field/flickrfield.module
Theme a Flickr photo set as an embedded Flickr.com slideshow (basic).

File

./flickr.module, line 986
The Flickr module.

Code

function theme_flickr_flickrcomslideshow_simple($variables) {
  $id = $variables['id'];
  $class = $variables['class'];
  $style = $variables['style'];
  if (isset($style)) {
    $attribs = flickr_split_style($style);
  }
  else {
    $attribs = NULL;
  }
  if (isset($attribs[0]['width'])) {
    if (strpos($attribs[0]['width'], '%') !== FALSE) {
      $width = $attribs[0]['width'];
      $div = '<div style="width: ' . (int) $width . '%;">';
      $width = '100%';
      $height = '100%';
    }
    else {
      $width = $attribs[0]['width'];
      $height = isset($attribs[0]['height']) ? $attribs[0]['height'] : round($width * variable_get('flickr_sshratio', 3) / variable_get('flickr_sswratio', 4)) . 'px';
      $div = '<div style="width: ' . (int) $width . 'px; height: ' . (int) $height . 'px;">';
    }
    $divend = '</div>';
  }
  else {
    $width = '100%';
    $height = '100%';
    $div = '';
    $divend = '';
  }
  unset($attribs[0]['width']);
  unset($attribs[0]['height']);
  $attribs = isset($attribs[0]) ? urldecode(http_build_query($attribs[0], '', '; ')) : NULL;
  $attribs = str_replace('=', ':', $attribs);
  $attribs = str_replace('"', '', $attribs);
  if (empty($id)) {
    return;
  }
  switch (flickr_get_id_type($id)) {
    case 'photoset':
      $info = flickr_photosets_getinfo($id);
      $user_id = $info['owner'];
      $src = 'https://www.flickr.com/slideShow/index.gne?group_id=&user_id=' . $user_id . '&set_id=' . $id . '&text=';
      break;
    case 'user':
      $src = 'https://www.flickr.com/slideShow/index.gne?group_id=&user_id=' . $id . '&set_id=&text=';
      break;
    case 'group':
      $src = 'https://www.flickr.com/slideShow/index.gne?group_id=' . $id . '&user_id=&set_id=&text=';
      break;
  }
  return $div . '<div class="flickr-slideshow ' . $class . '"><object width="' . $width . '" height="' . $height . '" style="' . $attribs . '" type="text/html" data="' . $src . '"></object></div>' . $divend;
}