You are here

function node_gallery_get_cover in Node Gallery 6.2

2 calls to node_gallery_get_cover()
template_preprocess_gallery_cover_view in theme/theme.inc
template_preprocess_gallery_teaser in theme/theme.inc

File

./node_gallery.inc, line 165
Node gallery models

Code

function node_gallery_get_cover($gallery) {
  if (!empty($gallery->images) && is_array($gallery->images)) {
    foreach ($gallery->images as $image) {
      if ($image->is_cover) {
        $cover_image = $image;
        break;
      }
    }
  }

  /*$cover_image = db_fetch_object(db_query("SELECT n.title, ng.*, f.* FROM {node} n INNER JOIN {node_galleries} ng ON n.nid = ng.nid
    INNER JOIN {files} f ON ng.fid = f.fid WHERE ng.gid = %d AND is_cover > 0", $gallery->gid));*/
  $config = node_gallery_get_config($gallery->type);
  if (empty($cover_image)) {
    $cover_image->filepath = $config['default_cover'];
  }
  $cover_image->title = $gallery->title;
  return $cover_image;
}