You are here

function photos_get_info in Album Photos 7.3

Same name and namespace in other branches
  1. 6.2 photos.module \photos_get_info()

Get photo informaiton.

18 calls to photos_get_info()
photos_album_page in inc/photos.album.inc
Album view.
photos_data_album in inc/photos.data.inc
Album slideshow data.
photos_data_user_slide in inc/photos.data.inc
All user photos slideshow.
photos_down_page in inc/photos.down.inc
Photos download (share) page.
photos_image_page in inc/photos.image.inc
Image page.

... See full list

File

./photos.module, line 1712
Implementation of photos.module.

Code

function photos_get_info($fid, $image = 0, $view = 0, $all = 0) {
  if ($fid) {
    if (!$all) {
      $image = db_select('file_managed')
        ->fields('file_managed', array(
        'fid',
        'uri',
        'filename',
      ))
        ->condition('fid', $fid)
        ->execute()
        ->fetchObject();
    }
    else {
      $image = db_query('SELECT f.uri, f.filemime, f.timestamp, f.filename, u.uid, u.name, p.* FROM {file_managed} f INNER JOIN {photos_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 = :fid', array(
        ':fid' => $fid,
      ))
        ->fetchObject();
    }
  }
  if (isset($image->fid)) {
    $sizes = photos_upload_info(0);
    if (variable_get('photos_access_photos', 0)) {
      $image->original = 'photos/get/' . $image->fid . '/original/' . $image->uri;
      foreach ($sizes['size'] as $thumb) {
        $image->thumb[$thumb['style']] = $thumb['name'];
      }
    }
    else {
      $image->original = $image->uri;
      foreach ($sizes['size'] as $thumb) {
        $image->thumb[$thumb['style']] = $thumb['name'];
      }
    }
    if ($view) {
      if (!isset($view['title']) && isset($image->title)) {
        $view['title'] = $image->title;
      }
      if (isset($view['style_name']) && !empty($view['style_name'])) {
        $style_name = $view['style_name'];
      }
      else {
        $style_name = variable_get('photos_thumb_imagesize', 'thumbnail');
      }
      if (isset($view['href'])) {
        $image->href = $view['href'];
      }
      if (isset($view['colorbox'])) {
        $view['colorbox'] = $image->thumb[variable_get('photos_display_view_imagesize', FALSE)];
      }
      return theme('photos_imagehtml', array(
        'image' => $image,
        'style_name' => $style_name,
      ));
    }
  }
  return $image;
}