You are here

function photos_data_album in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 inc/photos.data.inc \photos_data_album()
1 string reference to 'photos_data_album'
photos_menu in ./photos.module

File

inc/photos.data.inc, line 78

Code

function photos_data_album($node) {
  drupal_set_header('Content-Type: text/plain;');
  drupal_set_header('Cache-Control: no-cache, must-revalidate');
  drupal_set_header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
  if ($node->type == 'photos') {
    $order = explode('|', $node->album['imageorder'] ? $node->album['imageorder'] : variable_get('photos_display_imageorder', 'timestamp|desc'));
    $order = _photos_order_value_change($order[0], $order[1]);
    $result = db_query_range(db_rewrite_sql('SELECT f.fid, f.filepath, f.filemime, f.timestamp, f.filename, f.filesize FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid WHERE p.pid = %d' . $order, 'p', 'pid'), $node->nid, 0, 100);
  }
  else {
    $order = explode('|', variable_get('photos_display_imageorder', 'timestamp|desc'));
    $order = _photos_order_value_change($order[0], $order[1]);
    $result = db_query_range(db_rewrite_sql('SELECT f.fid, f.filepath, f.filemime, f.timestamp, f.filename, f.filesize FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {x_node} x ON p.fid = x.fid WHERE x.nid = %d' . $order, 'p', 'pid'), $node->nid, 0, 100);
  }
  $thumb = variable_get('photos_slide_show_thumb', 0);
  $view = variable_get('photos_slide_show_view', 0);
  $true = false;
  while ($images = db_fetch_array($result)) {
    $image = photos_get_info(0, $images);
    $array[] = array(
      'title' => $image['filename'],
      'timestamp' => $image['timestamp'],
      'thumbnail' => _photos_l($image['thumb'][$thumb]),
      'image' => _photos_l($image['thumb'][$view]),
    );
    $true = true;
  }
  if ($true) {
    $albums = array(
      array(
        'properties' => array(
          'title' => check_plain($node->title),
          'description' => check_plain($node->teaser),
          //相册描述
          'icon' => $node->album['cover']['url'],
        ),
        'images' => $array,
      ),
    );
    if (variable_get('photos_slide_music', false)) {
      $setting['config']['theme']['config_theme_music'] = $node->album['slide_music'] ? $node->album['slide_music'] : variable_get('photos_slide_music', false);
    }
    print dfgallery_json($albums, $setting);
  }
}