/** * Save the changes to this photo * @since Version 3.9 * @return self * @param \Railpage\Images\Image $imageObject */ public function setImage(Image $imageObject) { /** * Flush Memcache */ $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $imageObject->id); /** * Check if the title and/or description have changed */ if ($imageObject->title != $this->photo['title'] || $imageObject->description != $this->photo['description']) { $result = $this->cn->photos_setMeta($imageObject->id, $imageObject->title, $imageObject->description); $this->photo['title'] = $imageObject->title; $this->photo['description'] = $imageObject->description; if (!$result) { throw new Exception(sprintf("Could not update photo. The error returned from %s is: (%d) %s", self::PROVIDER_NAME, $this->cn->getErrorCode(), $this->cn->getErrorMsg())); } } $this->Memcached->save($mckey, $this->photo, strtotime("+2 days")); return $this; }
/** * Delete this photo * @since Version 3.9.1 * @return boolean * @param \Railpage\Railcams\Photo $photoObject */ public function deletePhoto(Photo $photoObject) { return $this->cn->photos_delete($photoObject->id); }
/** * Get photo context * @since Version 3.7.2 * @param int $photo_id * @return array */ public function getContext($photo_id = false) { if (!$photo_id) { throw new Exception("Cannot get photo context - no photo ID given"); return false; } $f = new \flickr_railpage(RP_FLICKR_API_KEY); $f->oauth_token = $this->flickr_oauth_token; $f->oauth_secret = $this->flickr_oauth_secret; $f->cache = false; $return = array(); $return = $f->photos_getContext($photo_id); /* $return['photo']['sizes'] = $f->photos_getSizes( $photo_id ); $return['photo']['time_relative'] = relative_date($return['photo']['dateuploaded']); */ return $return; }