function _photos_block_image in Album Photos 6.2
Same name and namespace in other branches
- 7.3 photos.module \_photos_block_image()
2 calls to _photos_block_image()
- photos_block in ./
photos.module - photos_page_default in inc/
photos.page.inc
File
- ./
photos.module, line 763
Code
function _photos_block_image($type, $limit, $url = 0, $uid = 0, $sort = ' f.fid DESC') {
switch ($type) {
case 'user':
$where = ' WHERE f.uid = ' . $uid;
break;
case 'rand':
$sort = ' RAND()';
}
$result = db_query_range(db_rewrite_sql('SELECT f.filepath, f.filemime, f.timestamp, f.filename, u.uid, u.name, p.* FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {users} u ON f.uid = u.uid' . $where . ' ORDER BY' . $sort, 'p', 'pid'), $limit);
while ($images = db_fetch_array($result)) {
$image[] = photos_get_info(0, $images);
}
if ($image[0]['fid']) {
$content = theme('photos_block', $image, 'image');
if ($url && count($image) >= $limit) {
$content .= theme('more_link', url($url), t('View more'));
}
if ($type == 'user') {
return array(
$content,
$image[0]['name'],
);
}
else {
return $content;
}
}
}