You are here

function media_gallery_mg_item_load in Media Gallery 7.2

Same name and namespace in other branches
  1. 7 media_gallery.module \media_gallery_mg_item_load()

Load a file object from the database, if it is part of the media_gallery node.

Parameters

$fid: The file ID.

$nid: The media_gallery node ID.

Return value

A fully-populated file object, or FALSE if the file is not part of the media_gallery.

See also

node_load()

file_load()

media_gallery_menu()

File

./media_gallery.module, line 174

Code

function media_gallery_mg_item_load($fid, $nid) {
  $node = node_load($nid);
  if ($node && $node->type == 'media_gallery' && in_array($fid, media_gallery_get_file_ids($node))) {
    return file_load($fid);
  }
  return FALSE;
}