Previous Next

Zend_Service_Flickr

Introduction to Searching Flickr

Zend_Service_Flickr is a simple API for using the Flickr REST Web Service. In order to use the Flickr web services, you must have an API key. To obtain a key and for more information about the Flickr REST Web Service, please visit the » Flickr API Documentation.

In the following example, we use the tagSearch() method to search for photos having "php" in the tags.

Example #1 Simple Flickr Photo Search

tagSearch("php");

foreach ($results as $result) {
    echo $result->title . '
'; }

Note: Optional parameter

tagSearch() accepts an optional second parameter as an array of options.

Finding Flickr Users' Photos and Information

Zend_Service_Flickr provides several ways to get information about Flickr users:

  • userSearch(): Accepts a string query of space-delimited tags and an optional second parameter as an array of search options, and returns a set of photos as a Zend_Service_Flickr_ResultSet object.

  • getIdByUsername(): Returns a string user ID associated with the given username string.

  • getIdByEmail(): Returns a string user ID associated with the given email address string.

Example #2 Finding a Flickr User's Public Photos by E-Mail Address

In this example, we have a Flickr user's e-mail address, and we search for the user's public photos by using the userSearch() method:

userSearch($userEmail);

foreach ($results as $result) {
    echo $result->title . '
'; }

Finding photos From a Group Pool

Zend_Service_Flickr allows to retrieve a group's pool photos based on the group ID. Use the groupPoolGetPhotos() method:

Example #3 Retrieving a Group's Pool Photos by Group ID

groupPoolGetPhotos($groupId);

    foreach ($results as $result) {
        echo $result->title . '
'; }

Note: Optional parameter

groupPoolGetPhotos() accepts an optional second parameter as an array of options.

Retrieving Flickr Image Details

Zend_Service_Flickr makes it quick and easy to get an image's details based on a given image ID. Just use the getImageDetails() method, as in the following example:

Example #4 Retrieving Flickr Image Details

Once you have a Flickr image ID, it is a simple matter to fetch information about the image:

getImageDetails($imageId);

echo "Image ID $imageId is $image->width x $image->height pixels.
\n"; echo "clickUri\">Click for Image\n";

Zend_Service_Flickr Result Classes

The following classes are all returned by tagSearch() and userSearch():

Zend_Service_Flickr_ResultSet

Represents a set of Results from a Flickr search.

Note:

Implements the SeekableIterator interface for easy iteration (e.g., using foreach), as well as direct access to a specific result using seek().

Properties

Zend_Service_Flickr_ResultSet Properties
Name Type Description
totalResultsAvailable int Total Number of Results available
totalResultsReturned int Total Number of Results returned
firstResultPosition int The offset in the total result set of this result set

Zend_Service_Flickr_ResultSet::totalResults()

int totalResults ( void )

Returns the total number of results in this result set.

Back to Class List

Zend_Service_Flickr_Result

A single Image result from a Flickr query

Properties

Zend_Service_Flickr_Result Properties
Name Type Description
id string Image ID
owner string The photo owner's NSID.
secret string A key used in url construction.
server string The servername to use for URL construction.
title string The photo's title.
ispublic string The photo is public.
isfriend string The photo is visible to you because you are a friend of the owner.
isfamily string The photo is visible to you because you are family of the owner.
license string The license the photo is available under.
dateupload string The date the photo was uploaded.
datetaken string The date the photo was taken.
ownername string The screenname of the owner.
iconserver string The server used in assembling icon URLs.
Square Zend_Service_Flickr_Image A 75x75 thumbnail of the image.
Thumbnail Zend_Service_Flickr_Image A 100 pixel thumbnail of the image.
Small Zend_Service_Flickr_Image A 240 pixel version of the image.
Medium Zend_Service_Flickr_Image A 500 pixel version of the image.
Large Zend_Service_Flickr_Image A 640 pixel version of the image.
Original Zend_Service_Flickr_Image The original image.

Back to Class List

Zend_Service_Flickr_Image

Represents an Image returned by a Flickr search.

Properties

Zend_Service_Flickr_Image Properties
Name Type Description
uri string URI for the original image
clickUri string Clickable URI (i.e. the Flickr page) for the image
width int Width of the Image
height int Height of the Image

Back to Class List

Previous Next
Introduction to Zend Framework
Overview
Installation
Zend_Acl
Introduction
Refining Access Controls
Advanced Use
Zend_Auth
Introduction
Database Table Authentication
Digest Authentication
HTTP Authentication Adapter
LDAP Authentication
Open ID Authentication
Zend_Cache
Introduction
The theory of caching
Zend_Cache frontends
Zend_Cache backends
Zend_Captcha
Introduction
Captcha Operation
Captcha Adapters
Zend_Config
Introduction
Theory of Operation
Zend_Config_Ini
Zend_Config_Xml
Zend_Console_Getopt
Introduction to Getopt
Declaring Getopt Rules
Fetching Options and Arguments
Configuring Zend_Console_Getopt
Zend_Controller
Zend_Controller Quick Start
Zend_Controller Basics
The Front Controller
The Request Object
The Standard Router: Zend_Controller_Router_Rewrite
The Dispatcher
Action Controllers
Action Helpers
The Response Object
Plugins
Using a Conventional Modular Directory Structure
MVC Exceptions
Migrating from Previous Versions
Zend_Currency
Introduction to Zend_Currency
How to work with currencies
Migrating from Previous Versions
Zend_Date
Introduction
Theory of Operation
Basic Methods
Zend_Date API Overview
Creation of dates
Constants for General Date Functions
Working examples
Zend_Db
Zend_Db_Adapter
Zend_Db_Statement
Zend_Db_Profiler
Zend_Db_Select
Zend_Db_Table
Zend_Db_Table_Row
Zend_Db_Table_Rowset
Zend_Db_Table Relationships
Zend_Debug
Dumping Variables
Zend_Dojo
Introduction
Zend_Dojo_Data: dojo.data Envelopes
Dojo View Helpers
Dojo Form Elements and Decorators
Zend_Dom
Introduction
Zend_Dom_Query
Zend_Exception
Using Exceptions
Zend_Feed
Introduction
Importing Feeds
Retrieving Feeds from Web Pages
Consuming an RSS Feed
Consuming an Atom Feed
Consuming a Single Atom Entry
Modifying Feed and Entry structures
Custom Feed and Entry Classes
Zend_File
Zend_File_Transfer
Validators for Zend_File_Transfer
Zend_Filter
Introduction
Standard Filter Classes
Filter Chains
Writing Filters
Zend_Filter_Input
Zend_Filter_Inflector
Zend_Form
Zend_Form
Zend_Form Quick Start
Creating Form Elements Using Zend_Form_Element
Creating Forms Using Zend_Form
Creating Custom Form Markup Using Zend_Form_Decorator
Standard Form Elements Shipped With Zend Framework
Standard Form Decorators Shipped With Zend Framework
Internationalization of Zend_Form
Advanced Zend_Form Usage
Zend_Gdata
Introduction to Gdata
Authenticating with AuthSub
Authenticating with ClientLogin
Using Google Calendar
Using Google Documents List Data API
Using Google Spreadsheets
Using Google Apps Provisioning
Using Google Base
Using the YouTube Data API
Using Picasa Web Albums
Catching Gdata Exceptions
Zend_Http
Zend_Http_Client - Introduction
Zend_Http_Client - Advanced Usage
Zend_Http_Client - Connection Adapters
Zend_Http_Cookie and Zend_Http_CookieJar
Zend_Http_Response
Zend_InfoCard
Introduction
Zend_Json
Introduction
Basic Usage
JSON Objects
XML to JSON conversion
Zend_Json_Server - JSON-RPC server
Zend_Layout
Introduction
Zend_Layout Quick Start
Zend_Layout Configuration Options
Zend_Layout Advanced Usage
Zend_Ldap
Introduction
Zend_Loader
Loading Files and Classes Dynamically
Loading Plugins
Zend_Locale
Introduction
Using Zend_Locale
Normalization and Localization
Working with Dates and Times
Supported Languages for Locales
Supported Regions for Locales
Zend_Log
Overview
Writers
Formatters
Filters
Zend_Mail
Introduction
Sending via SMTP
Sending Multiple Mails per SMTP Connection
Using Different Transports
HTML E-Mail
Attachments
Adding Recipients
Controlling the MIME Boundary
Additional Headers
Character Sets
Encoding
SMTP Authentication
Securing SMTP Transport
Reading Mail Messages
Zend_Measure
Introduction
Creation of Measurements
Outputting measurements
Manipulating Measurements
Types of measurements
Zend_Memory
Overview
Memory Manager
Memory Objects
Zend_Mime
Zend_Mime
Zend_Mime_Message
Zend_Mime_Part
Zend_OpenId
Introduction
Zend_OpenId_Consumer Basics
Zend_OpenId_Provider
Zend_Paginator
Introduction
Usage
Configuration
Advanced usage
Zend_Pdf
Introduction.
Creating and loading PDF documents.
Save changes to the PDF document.
Document pages.
Drawing.
Document Info and Metadata.
Zend_Pdf module usage example.
Zend_Registry
Using the Registry
Zend_Rest
Introduction
Zend_Rest_Client
Zend_Rest_Server
Zend_Search_Lucene
Overview
Building Indexes
Searching an Index
Query Language
Query Construction API
Character Set
Extensibility
Interoperating with Java Lucene
Advanced
Best Practices
Zend_Server
Introduction
Zend_Server_Reflection
Zend_Service
Introduction
Zend_Service_Akismet
Zend_Service_Amazon
Zend_Service_Audioscrobbler
Zend_Service_Delicious
Zend_Service_Flickr
Zend_Service_Nirvanix
Zend_Service_ReCaptcha
Zend_Service_Simpy
Introduction
Zend_Service_StrikeIron
Zend_Service_StrikeIron: Bundled Services
Zend_Service_StrikeIron: Advanced Uses
Zend_Service_Technorati
Zend_Service_Yahoo
Zend_Session
Introduction
Basic Usage
Advanced Usage
Global Session Management
Zend_Session_SaveHandler_DbTable
Zend_Soap
Zend_Soap_Server
Zend_Soap_Client
WSDL Accessor
AutoDiscovery. Introduction
Class autodiscovering.
Functions autodiscovering.
Autodiscovering. Datatypes.
Zend_Test
Introduction
Zend_Test_PHPUnit
Zend_Text
Zend_Text_Figlet
Zend_TimeSync
Introduction
Working with Zend_TimeSync
Zend_Translate
Introduction
Adapters for Zend_Translate
Using Translation Adapters
Zend_Uri
Zend_Uri
Zend_Validate
Introduction
Standard Validation Classes
Validator Chains
Writing Validators
Zend_Version
Reading the Zend Framework Version
Zend_View
Introduction
Controller Scripts
View Scripts
View Helpers
Zend_View_Abstract
Zend_Wildfire
Zend_Wildfire
Zend_XmlRpc
Introduction
Zend_XmlRpc_Client
Zend_XmlRpc_Server
Zend Framework Requirements
PHP Version
PHP Extensions
Zend Framework Components
Zend Framework Dependencies
Zend Framework Coding Standard for PHP
Overview
PHP File Formatting
Naming Conventions
Coding Style
Copyright Information