function delete() { $gallery_image_ids = AMP_lookup('galleries_by_image', $this->getName()); if ($gallery_image_ids) { require_once 'Modules/Gallery/Image.inc.php'; $finder = new GalleryImage(AMP_Registry::getDbcon()); $images = $finder->find(array('id' => array_keys($gallery_image_ids))); foreach ($images as $gallery_image) { $gallery_image->delete(); } } return parent::delete(); }
function _save_galleryInfo($data) { if (!(isset($data['galleryid']) && !empty($data['galleryid']))) { return false; } require_once 'Modules/Gallery/Image.inc.php'; $galleries = is_array($data['galleryid']) ? array_keys($data['galleryid']) : array($data['galleryid']); foreach ($galleries as $gallery_id) { $gallery_image = new GalleryImage(AMP_Registry::getDbcon()); $data['galleryid'] = $gallery_id; $gallery_image->setData($data); $gallery_image->save(); } }
public static function fetchFromParameters($postParams, $fileParams = null) { global $systemConfiguration; SliderImage::$staticErrors = array(); $sliderImage = new SliderImage(); $sliderImage->galleryImage = GalleryImage::fetchFromParameters($postParams, $fileParams); return $sliderImage; }
public function loadModel($id) { $model = GalleryImage::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function requireDefaultRecords() { parent::requireDefaultRecords(); $imagesToProcess = GalleryImage::get()->filter('ExifRead', 0); foreach ($imagesToProcess as $image) { $image->processExifData(); } DB::alteration_message('Updated image metadata where EXIF has not been ' . 'processed', 'changed'); }
/** * Resets all references to other model objects or collections of model objects. * * This method is a user-space workaround for PHP's inability to garbage collect * objects with circular references (even in PHP 5.3). This is currently necessary * when using Propel in certain daemon or large-volume/high-memory operations. * * @param boolean $deep Whether to also clear the references on all referrer objects. */ public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->aGalleryImage instanceof Persistent) { $this->aGalleryImage->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aGalleryImage = null; }
public static function fetchFromParameters($postParams, $fileParams = null) { global $systemConfiguration; global $logger; RoomImage::$staticErrors = array(); $roomImage = new RoomImage(); $roomImage->galleryImage = GalleryImage::fetchFromParameters($postParams, $fileParams); if (isset($postParams['room_id']) && is_numeric($postParams['room_id'])) { $roomImage->roomId = intval($postParams['room_id']); } else { if (is_null($roomImage->galleryImage)) { $logger->LogError("Gallery image is null."); } } return $roomImage; }
/** * Index Page, for now just render all static content. */ public function actionIndex() { //TODO add cache logic later. //load last 5 news $criteria = new CDbCriteria(); $criteria->limit = 5; $criteria->order = 'n_id DESC'; $news = News::model()->findAll($criteria); //load last 9 suggestion images $criteria = new CDbCriteria(); $criteria->limit = 9; $criteria->order = 'id DESC'; $criteria->condition = 'is_recommend = 1'; $images = GalleryImage::model()->findAll($criteria); $this->render('index', array('news' => $news, 'posts' => BlogPosts::post(), 'notices' => BlogPosts::notice(), 'images' => $images)); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param GalleryImage $obj A GalleryImage object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null GalleryImagePeer::$instances[$key] = $obj; } }
function compile_gallery_metadata($gallery_image_ids) { if (!$gallery_image_ids) { return array(); } require_once 'Modules/Gallery/Image.inc.php'; $image_finder = new GalleryImage(AMP_Registry::getDbcon()); $gallery_images = $image_finder->find(array('id' => array_keys($gallery_image_ids))); $metadata = array(); foreach ($gallery_images as $image) { $data = $image->getImageData(); foreach ($data as $key => $value) { if (!$value) { continue; } $metadata[$key] = $value; } } return $metadata; }
/** * Filter the query by a related GalleryImage object * * @param GalleryImage|PropelObjectCollection $galleryImage The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return GalleryImageSizeQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByGalleryImage($galleryImage, $comparison = null) { if ($galleryImage instanceof GalleryImage) { return $this->addUsingAlias(GalleryImageSizePeer::GALLERY_IMAGE_ID, $galleryImage->getId(), $comparison); } elseif ($galleryImage instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(GalleryImageSizePeer::GALLERY_IMAGE_ID, $galleryImage->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByGalleryImage() only accepts arguments of type GalleryImage or PropelCollection'); } }
/** * @param GalleryImage $galleryImage The galleryImage object to add. */ protected function doAddGalleryImage($galleryImage) { $this->collGalleryImages[] = $galleryImage; $galleryImage->setGalleryFolder($this); }
public function getGallery() { return $this->hasOne(GalleryImage::className(), ['id' => 'gallery_id']); }
public function LatestGalleryImages($amount = 4) { return GalleryImage::get()->sort('LastEdited DESC')->limit($amount); }
public function store_files($file_path, $file) { $is_image = getimagesize($file_path); $gallery_data = $this->options['gallery_data']; $base = new Base(); if ($is_image != 0 and $gallery_data['id'] != null) { $image_entity = new Image(); $image_entity->setName($file->name); $image_entity->setTitle($file->name); $image_entity->setPath($file_path); $base->audit_fields($image_entity, 'create'); $image_entity->save(); $gallery_image = new GalleryImage(); $gallery_image->setGalleryid($gallery_data['id']); $gallery_image->setImageid($image_entity->id); $base->audit_fields($gallery_image, 'create'); $gallery_image->save(); } else { $this->save_file_data($file->name, $file->type, $file->size, $file_path); } }
/** * Filter the query by a related GalleryImage object * * @param GalleryImage|PropelObjectCollection $galleryImage the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return GalleryFolderQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByGalleryImage($galleryImage, $comparison = null) { if ($galleryImage instanceof GalleryImage) { return $this->addUsingAlias(GalleryFolderPeer::ID, $galleryImage->getGalleryFolderId(), $comparison); } elseif ($galleryImage instanceof PropelObjectCollection) { return $this->useGalleryImageQuery()->filterByPrimaryKeys($galleryImage->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByGalleryImage() only accepts arguments of type GalleryImage or PropelCollection'); } }
if (isset($article[$i])) { ?> <!-- <input class="" type="submit" name="" value="">--> <li class="gallery-image-container"> <form action="" method="post"> <input class="" type="hidden" name="theContent" value="gallery"> <input class="" type="hidden" name="cur_gal_item" value="<?php echo $i; ?> "> <button class="gallery-button" type="submit"> <?php /*Attempts to find the gallery image and checks to see if it's active*/ $galleryImage = new GalleryImage($article[$i]["image_name"], $current, $i); ?> <img class="<?php echo $galleryImage->getImageClass(); ?> " src="<?php echo $galleryImage->getImageSrc(); ?> "> </button> </form> <div class="gallery-image-dev fc-white n-text"><?php echo $article[$i]['type'];
$galleryImage = GalleryImage::fetchFromParameters($_POST); if (!$galleryImage->save()) { $logger->LogError("Error saving news category."); foreach ($galleryImage->errors as $error) { $logger->LogError($error); $errors[] = $error; } } else { $message = "Values were updated successfully!"; } } else { if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) { $logger->LogInfo("Page was called for edit of id: " . $_REQUEST['id']); $id = intval($_REQUEST['id']); $logger->LogDebug("Numeric id is: {$id}"); $galleryImage = GalleryImage::fetchFromDb($id); if ($galleryImage == null) { $logger->LogError("Invalid request. No gallery image with id: {$id} exists."); $errors[] = "Invalid request. No gallery image with id: {$id} exists."; } } } include "header.php"; ?> </td> <tr> <td valign="top"> <?php if (sizeof($errors) > 0) { echo ' <table width="100%">' . "\n"; foreach ($errors as $error) {
/** * Exclude object from result * * @param GalleryImage $galleryImage Object to remove from the list of results * * @return GalleryImageQuery The current query, for fluid interface */ public function prune($galleryImage = null) { if ($galleryImage) { $this->addUsingAlias(GalleryImagePeer::ID, $galleryImage->getId(), Criteria::NOT_EQUAL); } return $this; }
function _checkUploadImage($data, $fieldname) { if (!(isset($data['image_upload']) && $data['image_upload'])) { if (!isset($data[$fieldname])) { return false; } return $data[$fieldname]; } if (!(isset($data['image_gallery']) && $data['image_gallery'])) { return $data['image_upload']; } require_once 'Modules/Gallery/Image.inc.php'; $gallery_record = new GalleryImage(AMP_Registry::getDbcon()); $gallery_data = array('img' => $data['image_upload'], 'caption' => isset($data['piccap']) ? $data['piccap'] : false, 'galleryid' => $data['image_gallery'], 'section' => $data['section'], 'publish' => true, 'date' => date('Y-m-d')); $gallery_record->setData($gallery_data); $gallery_record->save(); return $data['image_upload']; }
public static function fetchFromDb($id) { global $logger; $logger->LogInfo("Fetching gallery image for id: {$id}"); if (!is_numeric($id)) { $logger->LogError("Gallery image id: {$id} is not a valid number"); return null; } $sql = "SELECT * FROM bsi_gallery_images WHERE id = " . $id; return GalleryImage::fetchFromDbSqlSingle($sql); }