Ejemplo n.º 1
0
 /**
  * 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;
 }