You are here

function photos_get_info in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos.module \photos_get_info()
17 calls to photos_get_info()
photos_album_page in inc/photos.album.inc
photos_data_album in inc/photos.data.inc
photos_data_sub_block in inc/photos.data.inc
photos_data_user in inc/photos.data.inc
photos_down_page in inc/photos.down.inc

... See full list

File

./photos.module, line 1068

Code

function photos_get_info($fid, $image = 0, $view = 0, $all = 0) {
  if ($fid) {
    if (!$all) {
      $image = db_fetch_array(db_query('SELECT fid, filepath, filename FROM {files} WHERE fid = %d', $fid));
    }
    else {
      $image = db_fetch_array(db_query('SELECT f.filepath, f.filemime, f.timestamp, f.filename, n.title, u.uid, u.name, p.* FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {node} n ON p.pid = n.nid INNER JOIN {users} u ON f.uid = u.uid WHERE p.fid = %d', $fid));
    }
  }
  if ($image['fid']) {
    $sizes = photos_upload_info(0);
    if (variable_get('photos_access_photos', 0)) {
      $image['original'] = 'photos/get/' . $image['fid'] . '/original/' . $image['filepath'];
      foreach ($sizes['size'] as $thumb) {
        $image['thumb'][$thumb['name']] = 'photos/get/' . $image['fid'] . '/' . $thumb['name'] . '/' . photos_get_thumb($image['filepath'], $image['fid'], $thumb);
      }
    }
    else {
      $image['original'] = $image['filepath'];
      foreach ($sizes['size'] as $thumb) {
        $image['thumb'][$thumb['name']] = photos_get_thumb($image['filepath'], $image['fid'], $thumb, 1);
      }
    }
    if ($view) {
      if (!$view['filename']) {
        $view['filename'] = $image['filename'];
      }
      if ($view['label'] && in_array($view['label'], _photos_labels($sizes['size']))) {
        $label = $view['label'];
      }
      else {
        $label = variable_get('photos_title_0', false);
      }
      if ($view['link']) {
        $view['href'] = 'photos/image/' . $image['fid'];
      }
      if ($view['thickbox']) {
        $view['thickbox'] = $image['thumb'][variable_get('photos_display_view_imagesize', false)];
      }
      return theme('photos_imagehtml', $image['thumb'][$label], $view);
    }
    if ($image['des']) {
      $image['des'] = check_markup($image['des'], 0, FALSE);
    }
  }
  return $image;
}