Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment #2
Nathaniel CreditAttribution: Nathaniel commentedThat 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.Comment #3
Nathaniel CreditAttribution: Nathaniel commented