Exemplo n.º 1
0
 /**
  * Formats the raw data provided by Flickr and get the correct URL to the Flickr image.
  *
  * @access	public
  * @param	object	$photo	The metadata of the photo
  * @return	object			A stdClass object with it's own properties.
  */
 public function buildPhotoObject($photoItem)
 {
     // Initialize the token for the current request.
     $this->token = new OAuthConsumer($this->_access_token, $this->_secret_token);
     $options = array('method' => 'flickr.photos.getSizes', 'format' => 'json', 'nojsoncallback' => 1, 'photo_id' => $photoItem->id, 'privacy_filter' => 1);
     $result = parent::get($options);
     $sizes = $result->sizes->size;
     $photo = new stdClass();
     $photo->title = $photoItem->title;
     $photo->sizes = array();
     foreach ($sizes as $size) {
         $obj = new stdClass();
         $obj->title = $size->label;
         $obj->width = $size->width;
         $obj->height = $size->height;
         $obj->source = $size->source;
         $photo->sizes[$size->label] = $obj;
     }
     return $photo;
 }