function gallery($gallery_id) { require_once 'Modules/Gallery/Image.inc.php'; $image_record = new GalleryImage(AMP_Registry::getDbcon()); $image_record->setGallery($gallery_id); $image_record->setImageFileName($this->getName()); $image_record->publish(); $image_record->setItemDate(date('Y-m-d', $this->getTime())); $db_metadata = $this->getData(); unset($db_metadata['id']); $image_record->mergeData($db_metadata); $result = $image_record->save(); $this->notify('update'); $this->notify('gallery'); AMP_lookup_clear_cached('galleries_by_image', $this->getName()); return $result; }