/** * insertCategory * * @return boolean */ protected function insertCategory() { // If mass_photos_category is set, we already created the category // just set the newCategoryId and move on if (isset($_SESSION['mass_photos_category'])) { $this->newCategoryId = $_SESSION['mass_photos_category']; } else { // Insert new category if (!parent::insertCategory()) { return false; } // Set var so we don't create a category with each file in the upload $_SESSION['mass_photos_category'] = $this->newCategoryId; } return true; }
/** * insertPhoto * * Overwrite the base insertPhoto function, so we can prevent * multiple photo ids from being created * * @return void */ protected function insertPhoto() { // Don't insert photo for thumb or full if ($this->formData['photo_type'] !== 'main') { // The id should be the same as the last 'main' photo // that was uploaded $lastMainPhoto = end($_SESSION['photos']); $this->newPhotoId = $lastMainPhoto['id']; return true; } // Only for main return parent::insertPhoto(); }