class ImageGateway in Node Gallery 6
Hierarchy
- class \ImageGateway
Expanded class hierarchy of ImageGateway
File
- ./
node_gallery.model.inc, line 206 - Node gallery module.
View source
class ImageGateway {
static function find_details($nids) {
$nids = is_numeric($nids) ? array(
$nids,
) : (array) $nids;
$sql = "SELECT n.nid, n.vid, n.title, n.type, n.created, nr.body, i.*, f.* FROM {node} n \n INNER JOIN {node_revisions} nr ON n.vid = nr.vid INNER JOIN {ng_images} i \n ON n.nid = i.nid INNER JOIN {files} f ON i.fid = f.fid WHERE n.nid IN (" . db_placeholders($nids) . ") AND n.status = 1\n ORDER BY i.weight, i.nid";
$result = db_query($sql, $nids);
while ($o = db_fetch_object($result)) {
$items[$o->nid] = new Image($o);
}
if (module_exists('content')) {
foreach ($items as &$item) {
$content_type = content_types($item->type);
if (!empty($content_type['fields'])) {
content_load($item);
}
}
}
return $items;
}
static function get_file($nids) {
$nids2 = is_numeric($nids) ? array(
$nids,
) : (array) $nids;
$result = db_query("SELECT i.*, f.* FROM {ng_images} i INNER JOIN {files} f ON i.fid = f.fid WHERE i.nid \n IN (" . db_placeholders($nids2) . ")", $nids2);
while ($r = db_fetch_array($result)) {
$items[$r['nid']] = new Image($r);
}
return is_numeric($nids) ? $items[$nids] : $items;
}
static function delete($image) {
db_query("DELETE FROM {ng_images} WHERE nid = %d", $image->nid);
db_query("DELETE FROM {files} WHERE fid = %d", $image->fid);
file_delete($image->filepath);
// Make sure to flush out the old imagecache images
if (function_exists(imagecache_image_flush)) {
imagecache_image_flush($image->filepath);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ImageGateway:: |
static | function | ||
ImageGateway:: |
static | function | ||
ImageGateway:: |
static | function |