function _photos_edit_page_album_images in Album Photos 7.3
Get images for album management page.
3 calls to _photos_edit_page_album_images()
- photos_edit_page in inc/
photos.edit.inc - Image management.
- photos_edit_sort_page in inc/
photos.edit.inc - Grid drag and drop image sorting.
- _photos_edit_page_album in inc/
photos.edit.inc - Album image management page.
File
- inc/
photos.edit.inc, line 608 - Handles uploading and editing images.
Code
function _photos_edit_page_album_images($nid, $limit = 10) {
$images = array();
$column = isset($_GET['field']) ? $_GET['field'] : '';
$sort = isset($_GET['sort']) ? $_GET['sort'] : '';
$term = _photos_order_value($column, $sort, $limit, array(
'column' => 'p.wid',
'sort' => 'asc',
));
$query = db_select('file_managed', 'f')
->extend('PagerDefault');
$query
->join('photos_image', 'p', 'p.fid = f.fid');
$query
->join('users', 'u', 'f.uid = u.uid');
$query
->join('node', 'n', 'n.nid = p.pid');
$query
->fields('f', array(
'uri',
'filemime',
'timestamp',
'filename',
'filesize',
));
$query
->fields('p');
$query
->fields('u', array(
'uid',
'name',
));
$query
->condition('p.pid', $nid);
$query
->limit($term['limit']);
$query
->orderBy($term['order']['column'], $term['order']['sort']);
$query
->addTag('node_access');
$result = $query
->execute();
foreach ($result as $data) {
$images[] = photos_get_info(0, $data);
}
if (isset($images[0]->fid)) {
$node = node_load($nid);
$images[0]->info = array(
'pid' => $node->nid,
'title' => $node->title,
'uid' => $node->uid,
);
if (isset($node->album['cover'])) {
$images[0]->info['cover'] = $node->album['cover'];
}
}
return $images;
}