views:

114

answers:

1

I am reading this page about Zend_Service_Flickr. However it does not say how to set up the number of photos showing.

The following code returns 10 images.

Zend_Loader::loadClass('Zend_Service_Flickr');
$flickr = new Zend_Service_Flickr($this->flickrapikey);
$results = $flickr->userSearch($this->flickemail);

Could anyone tell me how to set it up please?

Thanks in advance.

+1  A: 

If you take a look at the code source of Zend_Service_Flickr::userSearch (see here for instance), you'll notice it starts with this piece of code :

/**
 * Finds photos by a user's username or email.
 *
 * Additional query options include:
 *
 *  # per_page:        how many results to return per query
 *  # page:            the starting page offset.  first result will be (page - 1) * per_page + 1
 *  # min_upload_date: Minimum upload date to search on.  Date should be a unix timestamp.
 *  # max_upload_date: Maximum upload date to search on.  Date should be a unix timestamp.
 *  # min_taken_date:  Minimum upload date to search on.  Date should be a MySQL datetime.
 *  # max_taken_date:  Maximum upload date to search on.  Date should be a MySQL datetime.
 *
 * @param  string $query   username or email
 * @param  array  $options Additional parameters to refine your query.
 * @return Zend_Service_Flickr_ResultSet
 * @throws Zend_Service_Exception
 */
public function userSearch($query, array $options = null)
{
    static $method = 'flickr.people.getPublicPhotos';
    static $defaultOptions = array('per_page' => 10,
                                   'page'     => 1,
                                   'extras'   => 'license, date_upload, date_taken, owner_name, icon_server');
    ...
    ...

This should be enough to help you understand how to specify how many photos you'd like to get : you probably just have to pass an array as second parameter, containing an entry with the key "per_page", and the value you want.

Somethong like this, I suppose (not tried, though) :

Zend_Loader::loadClass('Zend_Service_Flickr');
$flickr = new Zend_Service_Flickr($this->flickrapikey);
$results = $flickr->userSearch($this->flickemail, array(
    'per_page' => 20
  ));

When the documentation is not good enough, don't hesitate to take a look at the code ;-)

Pascal MARTIN