Update of /cvsroot/phpwebsite-comm/modules/featuredphoto/class/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29746/class/lib
Modified Files:
Flickr.php
Log Message:
Can now display photos from Flickr
Index: Flickr.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/featuredphoto/class/lib/Flickr.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Flickr.php 26 Jan 2008 18:03:54 -0000 1.2
--- Flickr.php 26 Jan 2008 22:32:52 -0000 1.3
***************
*** 132,135 ****
--- 132,165 ----
/**
+ * Get the largest size that will fit in the specified dimensions.
+ *
+ * @access public
+ *
+ * @param int Maximum width of a photo
+ * @param int Maximum height of a photo
+ * @return string Photo size that best fits the dimensions
+ */
+ function best_photo_size($width, $height)
+ {
+ $sizes = array('large' => 1024,
+ 'medium' => 500,
+ 'small' => 240,
+ 'thumbnail' => 100,
+ 'square' => 75);
+
+ $min = (($width < $height) ? $width : $height);
+ foreach ($sizes as $str => $px)
+ {
+ if ($min > $px)
+ {
+ return $str;
+ }
+ }
+
+ /* If we make it to here, return the smallest size possible. */
+ return 'square';
+ }
+
+ /**
* Build a photo's Flickr URL.
*
***************
*** 216,219 ****
--- 246,262 ----
/**
+ * Retrieve a photoset's information
+ *
+ * @access public
+ * @note http://www.flickr.com/services/api/flickr.photosets.getInfo.html
+ * @return mixed Photoset node on success, PHPWS_Error on failure
+ */
+ function photosets_getInfo($photoset_id)
+ {
+ $resp = $this->_request('flickr.photosets.getInfo', array('photoset_id'=>$photoset_id));
+ return (PEAR::isError($resp) ? $resp : $resp['photoset']);
+ }
+
+ /**
* Get a listing of a user's photo sets
*
|