English 中文(简体)
How to set the number of photos in flickr
原标题:

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.

最佳回答

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 ;-)

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签