You are here

function photos_data_user_slide in Album Photos 7.3

All user photos slideshow.

1 string reference to 'photos_data_user_slide'
photos_menu in ./photos.module
Implements hook_menu().

File

inc/photos.data.inc, line 28
Handles slideshow integration.

Code

function photos_data_user_slide($account) {
  drupal_add_http_header('Content-Type:', 'text/plain;');
  drupal_add_http_header('Cache-Control:', 'no-cache, must-revalidate');
  drupal_add_http_header('Expires:', 'Sat, 26 Jul 1997 05:00:00 GMT');
  $query = db_select('file_managed', 'f');
  $query
    ->join('photos_image', 'p', 'p.fid = f.fid');
  $query
    ->join('node', 'n', 'p.pid = n.nid');
  $query
    ->join('photos_album', 'a', 'a.pid = n.nid');
  $query
    ->fields('f', array(
    'fid',
    'uri',
    'filemime',
    'timestamp',
    'filename',
    'filesize',
  ))
    ->fields('n', array(
    'nid',
    'title',
  ))
    ->condition('n.uid', $account->uid)
    ->condition('a.count', '0', '>')
    ->orderBy('f.fid', 'DESC')
    ->range(0, 500);
  $result = $query
    ->execute();
  $thumb = variable_get('photos_slide_show_thumb', 'thumbnail');
  $view = variable_get('photos_slide_show_view', 'large');
  $true = FALSE;
  $t = array();
  foreach ($result as $image) {
    $t[$image->nid]['node'] = array(
      'title' => $image->title,
      'link' => url('photos/album/' . $image->nid),
    );
    $images = photos_get_info(0, $image);
    $t[$image->nid]['image'][] = array(
      'title' => $images->filename,
      'timestamp' => $images->timestamp,
      'thumbnail' => _photos_l($image->uri, $thumb),
      'image' => _photos_l($image->uri, $view),
    );
    $true = TRUE;
  }
  if ($_GET['type'] != 'xml' && $true) {
    foreach ($t as $key => $v) {
      $album[] = array(
        'properties' => $t[$key]['node'],
        'images' => $t[$key]['image'],
      );
    }
    if (variable_get('photos_slide_music', FALSE)) {
      $setting['config']['theme']['config_theme_music'] = variable_get('photos_slide_music', FALSE);
    }
    if (module_exists('dfgallery')) {
      print dfgallery_json($album, $setting);
    }
  }
}