Download - LinuxFocus
Transcript
Chapter 4 Let us assume the URI to the project root is http://mydomain.com/myproject. Hence, the URI to execute the auto controller for logging in will be http:// mydomain.com/myproject/flickr_recent. The flickr_wrapper.php library file The application/libraries/flickr_wrapper.php library file contains the library flickr_wrapper class library that we are building and using to access the Flickr App Garden API. It is mandatory to load this library with a valid Flickr api_key that you can get by following the Flickr App Garden documentation. The library will use the PHP REST API access, so that we can later expand any of the Flickr API services to be supported with our library. Each of the library methods returns a multidimensional keyed array of the resultant data. The following is the code: /** * CodeIgniter Flickr API wrapper Library Class * * Enable Simple Flickr API usage * * @package CodeIgniter * @category Libraries * @author Eli Orr * Usage: * Via CI controller: * $this->load->library( 'flickr_wrapper', * array( 'api_key' => '<YOUR_FLICKR_API_KEY>', * 'DEFAULT_RES' => '3000', // filter 3000 pix * 'GPS_ENABLED' => FALSE )); * $this->flickr_wrapper->set_params ( $keyed_array ); * $recent_photos = * $this->flickr_wrapper->flickrPhotosGetRecent (); * $filter_photos = * $this->flickr_handler-> * filter_photos ($photos_to_filter); * $user_info = * $this->flickr_wrapper->flickrUserInfo ($uid); * // $uid e.g. 72095130@N00 //.PRIVATE //We will use the following private functions: private function _file_get_contents_curl($url); private function _flickrRestAPI ($params); private function _is_filtered_photo ($photo_rec ); */ [ 77 ]