Hi,
Just a few thoughts around how photos_image_page() function is loading up the image data. I think it would be valuable to move this into a dedicated function something like photos_image_page_load_image. So that other modules can also load the image data.

essentially, move all this to a dedicated function:

  $query = db_select('file_managed', 'f');
  $query->join('photos_image', 'p', 'p.fid = f.fid');
  $query->join('photos_album', 'a', 'p.pid = a.pid');
  $query->join('node', 'n', 'n.nid = p.pid');
  $query->join('users', 'u', 'u.uid = f.uid');
  $query->fields('f', array('uri', 'filemime', 'timestamp', 'filename'))
    ->fields('p')
    ->fields('a', array('data'))
    ->fields('u', array('uid', 'name'));
  $query->condition('p.fid', $fid);
  $image = $query->execute()->fetchObject();

Happy to provide a patch if this is valuable.

Comments

dakku created an issue. See original summary.

Nathaniel’s picture

That sounds fine to me! I'll check photos.module and see what is there, then add it there. Maybe just photos_image_load(). Then the include won't have to be loaded to use the function.

Nathaniel’s picture