Tải bản đầy đủ (.pdf) (450 trang)

flickr mashups

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.11 MB, 450 trang )

Flickr

Mashups
David Wilkinson
01_097748 ffirs.qxp 12/14/06 5:51 PM Page iii
01_097748 ffirs.qxp 12/14/06 5:51 PM Page ii
Flickr

Mashups
01_097748 ffirs.qxp 12/14/06 5:51 PM Page i
01_097748 ffirs.qxp 12/14/06 5:51 PM Page ii
Flickr

Mashups
David Wilkinson
01_097748 ffirs.qxp 12/14/06 5:51 PM Page iii
Flickr

Mashups
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-09774-8
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
1MA/QU/QR/QX/IN


No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA
01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal
Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or
online at />LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESEN-
TATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF
THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WAR-
RANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY
SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUIT-
ABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT
ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL
ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT.
NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE
FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A
POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER
ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT
MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY
HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please contact our Customer
Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Library of Congress Cataloging-in-Publication Data
Wilkinson, David.
Flickr mashups / David Wilkinson.
p. cm.
Includes index.
ISBN-13: 978-0-470-09774-8 (paper/website)
ISBN-10: 0-470-09774-4 (paper/website)
1. Flickr (Electronic resource) 2. Photography—Digital techniques. 3. Image processing—Digital techniques. I. Title.

TR267.5.F55W55 2007
775—dc22
2006036645
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade-
marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries,
and may not be used without written permission. Flickr is a trademark of Yahoo!, Inc. All other trademarks are the prop-
erty of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this
book.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.
01_097748 ffirs.qxp 12/14/06 5:51 PM Page iv
To Sue
01_097748 ffirs.qxp 12/14/06 5:51 PM Page v
About the Author
David Wilkinson is a highly skilled freelance technical consultant and programmer with more than 20
years’ experience in the IT industry, delivering business-critical systems to many blue-chip companies,
including BP, Jaguar, Land Rover, Tesco, and Lloyds TSB. He also acts as operations manager at Utata, a
community web site supporting photographers all over the world, and is responsible for the operation
of the Utata site and its integration with Flickr. A keen amateur photographer, he discovered Flickr in its
very early days and been a staunch advocate of it ever since.
01_097748 ffirs.qxp 12/14/06 5:51 PM Page vi
Credits
Excecutive Editor
Chris Webb
Development Editor
Brian MacDonald
Technical Editor
Sam Judson
Production Editor
Michael Koch

Copy Editor
S. B. Kleinman
Editorial Manager
Mary Beth Wakefield
Production Manager
Tim Tate
Vice President and Executive Group Publisher
Richard Swadley
Vice President and Executive Publisher
Joseph B. Wikert
Project Coordinator
Kristie Rees
Graphics and Production Specialists
Jonelle Burns, Barbara Moore, Alicia B. South
Quality Control Technician
John Greenough
Proofreading and Indexing
Techbooks
Anniversary Logo Design
Richard Pacifico
01_097748 ffirs.qxp 12/14/06 5:51 PM Page vii
01_097748 ffirs.qxp 12/14/06 5:51 PM Page viii
Acknowledgments
Although it’s my name that gets printed on the front cover, a book like this is never the work of a single
individual. Not only were many different people involved in the production of this book, there were
many others who helped pave the path that led here.
The first credit has to go to Chris Webb at Wiley. He is the man who persuaded me to embark on such an
insane venture as writing a book in the first place. To him, I have just one thing to say—Chris, thank you
for convincing me; I have thoroughly enjoyed the experience. Next, we have my development editor,
Brian MacDonald, who very patiently guided me through the process of taking a series of random

thoughts and turning them into a (hopefully) coherent printed book, and Sam Judson, author of the
Flickr.Net API library, who did a grand job as technical reviewer. Thank you all. There are many other
people behind the scenes at Wiley/Wrox who played a valuable role in getting this book out into the
world, but I would especially like to mention Carol Kessel, who helped my wife get to grips with the
American taxation system. Thank you, Carol — you were much more help than the man at the IRS.
I’d like to thank my long-time friend and colleague Nick Holloway, who got lumbered with the task of
checking over my code to make sure I didn’t do anything really dumb. If you find any remaining errors,
it’s almost certainly because I ignored his advice. A number of other people provided vast amounts of
moral support during the writing of this book. In particular, Catherine Jamieson was never without an
encouraging word, and Paul May’s regular Skype calls were a great boost. Thank you both. And Richard
Williams — I promised I would mention you in the acknowledgments, so here is your moment of fame.
Of course, life isn’t one great long book-writing session — there’s other work that has to be done too. I’d
like to thank the other people I was supposed to be doing work for, for being both patient and forgiving
during the writing of this book — especially Chris Pring and Mark Menzies, both of whom had to wait
their turn in the queue.
Just about all of the photos you see featured in this book are mine and you can find them in my Flickr
photostream. The Utata badges featured in Chapter 10, however, incorporate photos from a number of
the Utata group admins. Catherine Jamieson, Carolynn Primeau, Bryan Partington, Brenda Anderson,
Greg Fallis, Brittney Bush, Carrie Musgrave, Karl Randay, and Shari DeAngelo — thank you all for very
kindly allowing me to use your photographs here.
No book about Flickr would be complete without a word of acknowledgment for some of the people
who helped create it in the first place: Stewart Butterfield, Caterina Fake, George Oates, and Eric
Costello, with Heather Champ helping to keep the unruly masses in some kind of order — they all
deserve a mention. It is they, and the rest of the Flickr staff, whom I must thank for creating one of the
best online communities I have come across in a very long time. There is, of course, another name to
mention here. In this book, I must reserve a special mention for Cal Henderson, the man behind the
Flickr API. Without his contribution to Flickr, there would be no reason for this book to exist.
Many third-party pieces of software are used in the projects in this book — PHP, MySQL,
Greasemonkey, and many others. I would also like to thank the very many people involved in the cre-
01_097748 ffirs.qxp 12/14/06 5:51 PM Page ix

x
Acknowledgments
ation of these various tools for making them available to us — without them, building mashups such as
those featured in this book would be nigh impossible. I’d especially like to thank Dan Coulter, whose
phpFlickr library is used extensively throughout this book.
Flickr isn’t just about the photos — it’s also about the community, the people who take part. Without
them, Flickr would be a very different place. Through Flickr I’ve met a wide variety of people, scattered
all over the globe — from curiouskiwi on the other side of the world in New Zealand to chapmonkey,
who lives just a dozen or so miles away. Thanks to Flickr, I’ve exchanged food parcels with coffeefloat in
Jakarta and chotda in Guam, I’ve swapped Moo Minicards with missyasmina in Milan, and as part of
Swaptata I’ve received prints of fabulous photos from people all around the world. I’ve made some
very good friends on Flickr — there’s Kathya Ethington in Wiesbaden (who shares my great love of
food), there’s Cindi Miller Herleman in Colorado, and, well, there’s just too many more to name individ-
ually. Thank you all for making Flickr such a great place to be. Speaking of community, the finest com-
munity of all is to be found in the Utata group — in all my years of using the Internet, I’ve yet to find a
better group of people to hang out with. Above all else, it is the Utatans who inspired me to build the
systems that run the Utata web site, and the Utata web site is, I think, the greatest Flickr mashup of all.
And finally, because one always saves the best until last, I thank my wife, Sue, for all her help and
encouragement throughout the writing of this book. Without her support, none of this would be possi-
ble. Thank you.
01_097748 ffirs.qxp 12/14/06 5:51 PM Page x
Contents
Acknowledgments ix
Introduction xix
Chapter 1: Rewriting the Web 3
Web 2.0: Power to the People 3
Remixes and Mashups 4
What Makes a Mashable System? 4
Are You Allowed to Mash the Content? 4
How Easy Is It to Get the Content? 5

Mashup Architectures 5
Mashing on the Client 5
Mashing on the Server 6
Understanding Mashup Tools and Technologies 7
HTML, XHTML, and CSS 7
XML and XPath 9
JavaScript and DOM 11
AJAX 12
JSON 12
Web Servers and HTTP 14
Web Browsers 16
PHP and Perl 16
Regular Expressions 17
REST 19
SOAP 20
XML-RPC 20
Databases 21
Curl 22
Summary 22
Chapter 2: Flickr: A Short Tour 23
Creating an Account 23
Account Types 24
Setting a URL 24
Uploading Photographs 24
Photo Formats and Sizes 27
Photo IDs and URLs 27
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xi
xii
Contents
Organizing Your Photographs 27

The Photostream 28
Sets 29
Organizr 31
Tags 33
NIPSA 35
The Social Network: Contacts, Friends and Family 35
Groups 37
Interestingness 38
Copyright 39
All Rights Reserved 39
Creative Commons 40
Linking Back to Flickr 40
Summary 41
Exercises 41
Chapter 3: Getting Ready to Mash 43
Getting an API Key 43
Setting Up a Development Environment 45
Setting Up Your Web Server 46
Microsoft IIS 46
Finding Your Document Root 46
Installing PHP 47
Configuring IIS 49
Testing Your Setup 52
Apache 53
Installing Apache 53
Finding Your Document Root 54
Installing PHP 55
Configuring Apache 55
Testing Your Setup 55
Setting Up Other Systems 56

Setting Up Directories 56
Setting Up Perl 57
Installing Perl Under Microsoft Windows 57
Installing Perl on Unix Systems 59
Summary 60
Exercises 60
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xii
xiii
Contents
Chapter 4: The Flickr API 61
What Is an API? 61
Talking to Flickr 61
Character Encoding 62
Request Format 62
REST 62
SOAP 66
XML-RPC 68
Flickr Methods and Objects 71
Methods and Responses 71
Building URLs 75
The Photostream URL 75
The Profile URL 75
The Photo Page URL 76
The Image URL 77
Photoset URLs 78
The Buddy Icon URL 78
The Group Icon URL 79
Using the API Explorer 79
Using an API Kit 82
Be a Good Flickr Citizen 82

Commercial Use 82
Minimizing API calls 83
Flickr Resources 83
Flickr Services Page 83
Flickr Developer Support Group 84
Flickr API Group 84
Summary 84
Exercises 84
Chapter 5: Flickr Feeds 87
What Is a Feed? 87
Available Flickr Feeds 89
Feed Formats 89
RSS 91
Atom 92
PHP 94
Serialized PHP 94
JSON 95
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xiii
xiv
Contents
CSV 96
YAML 96
SQL 97
CDF 98
Creating a Flickr Badge 99
Designing the Badge 99
A Server-Side Badge Using PHP 100
A Client-Side Badge Using JavaScript 110
Summary 112
Exercises 113

Chapter 6: Remixing Flickr Using the API 115
The Basics: A Simple Photo Gallery 115
Setting Things Up 116
Displaying the Photos 122
Styling the Results 125
The Photo Page 127
Using AJAX 131
The prototype.js library 131
Enhancing the Gallery 136
Smart Sets 139
Summary 146
Exercises 146
Chapter 7: Authenticating with Flickr 147
The Need for Secrecy 147
Authenticating with Flickr 148
Configuring Your API Key 148
A Typical Authentication Sequence 151
Authentication and API Kits 153
Building an Authenticator 154
Updating Your Photo’s Details 161
Other Authentication Mechanisms 167
Desktop Application Authentication 167
Mobile Application Authentication 167
Summary 168
Exercises 168
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xiv
xv
Contents
Chapter 8: Uploading Photos 169
How Does Uploading Work? 169

Creating an Upload Page 171
Asynchronous Uploading 176
Replacing Photos 177
Summary 177
Exercise 177
Chapter 9: Remixing Flickr Using Greasemonkey 179
What is Greasemonkey? 179
Installing Greasemonkey 179
Creating Your First Script 181
Modifying Pages — A First Remix 183
Determining a User’s NSID 183
Completing the Remix 185
Using XPath 188
Highlighting Comments: A Second Remix 190
Enhancing the Flickr Paginator 194
Learning More About Greasemonkey 199
Summary 199
Exercises 199
Chapter 10: Working with ImageMagick 201
What Is ImageMagick? 201
Building a Group Badge 205
Building Better Badges 213
More than Just Badges 215
Summary 216
Exercises 216
Chapter 11: Visualizing the News 219
The RSS Format 219
Magpie 221
Installing Magpie 221
Setting Up Magpie’s Cache 221

Finding Images on Flickr 225
Putting Words and Images Together 227
Summary 239
Exercise 239
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xv
xvi
Contents
Chapter 12: Searching the Blogosphere 241
What Is Technorati? 241
Getting a Technorati API Key 242
Searching the Technorati Cosmos 242
Talking to Technorati with Greasemonkey 243
Understanding the Response 245
Putting It All Together 248
Summary 254
Exercise 254
Chapter 13: Displaying Your Photos with Google Maps 255
What Is Geodata? 255
Using Google Maps 256
Getting a Google Maps API Key 260
Adding Controls to Your Map 264
Building the Mashup 266
Adding Geodata to Flickr Photos 266
Retrieving Geodata from Flickr Photos 267
Processing the Geodata 269
Laying the Groundwork 271
Adding Markers to the Map 274
Populating the Info Window 278
Creating a Sidebar 282
Summary 288

Exercises 288
Chapter 14: Caching Your Data 289
To Cache or Not to Cache 289
Why Should You Cache? 289
What Should You Cache? 290
Where Should You Cache? 291
A Case Study 291
The Origins of Utata 291
Tagging Projects 292
Tracking Membership 292
Introducing a Database 295
Utata Today 296
Updating the Gallery 296
Installing MySQL 296
Microsoft Windows 296
Unix 298
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xvi
xvii
Contents
Getting Started with MySQL 298
Checking Your Installation 299
Creating a Database 300
Creating a Table 300
Adding Data to Your Database 301
Viewing Your Data 302
Searching Your Data 303
Sorting Your Data 305
Modifying Your Data 305
Deleting Data 306
Talking to MySQL with PHP 306

Caching Photos 311
The Photo Table 311
Using the Cache 320
Navigating Through Your Photos 324
Making Smart Sets Smarter 328
Identifying Smart Sets 328
Viewing the Smart Set 331
Summary 335
Exercise 336
Appendix A: Answers to Exercises 337
Appendix B: Flickr API Methods 379
Appendix C: Response Data Structures 385
Appendix D: Useful Resources 399
Index 405
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xvii
02_097748 ftoc.qxp 12/14/06 5:52 PM Page xviii
Introduction
When Flickr was launched in early 2004, few would have expected that a little more than a year later it
would not only have become one of the top photo-sharing sites on the Internet, but also have caught the
eye of the Internet giant Yahoo!, which acquired Flickr and its parent company Ludicorp in March 2005.
Many things could be said to have contributed to Flickr’s enormous success: the intuitive user interface,
the friendly tone of the text scattered about the site, the emphasis on the social aspects of building a
web-based community, perhaps even just its being in the right place at the right time. One thing is clear
— the decision to open up Flickr to the outside world was a smart one. Allowing developers to create
applications that can fully interact with Flickr, storing and retrieving photos, together with all the other
details stored alongside them, has spawned a whole secondary industry in Flickr-based applications. It
seems that you can find practically everything out there — from tools to help you upload your photos to
applications to turn your photostream into a bound and printed book. Everyone, from hobbyists to busi-
nesses, is getting in on the act.
The emergence of mashups as a means of building systems presents a whole new world of possibilities.

No longer do you have to wait for a company to implement the features you know you need — you can
just do it yourself. If Flickr doesn’t provide a way to automatically build sets of your most interesting
photos, you don’t need to sit waiting in despair — you can go ahead and create the necessary functional-
ity. Perhaps you want to geotag your photos, but Flickr’s maps don’t cover your local area very well?
That’s not a problem — use the Flickr API to enable you to overlay your photos onto Google maps
instead. If you don’t like Google Maps, take your own aerial photographs and use those! No matter how
niche your requirements are, the fact that companies like Flickr are opening up their systems to outside
developers means that you can supplement the services they provide to get just what you need, regard-
less of how bizarre or offbeat that need is.
Flickr is a great starting point for building mashups — a picture is worth a thousand words, and pictures
are something Flickr has in abundance. You only have to visit Flickr fleetingly to realize that it is packed
full of great photographs — pictures of pretty much everywhere in the world. From Antarctic survey sta-
tions to Brazilian rain forests, from New York skyscrapers to African desert scenes — with such an abun-
dance of spectacular imagery, it is little wonder that people want to build new ways to explore and
interact with this vast photographic database. Whatever it is you want to display, chances are you will
find it on Flickr.
Whom This Book Is For
If you are interested in building software that interfaces with Flickr in some way, then this book is for
you. You’ll need to be comfortable with a few things first, though. In this book, I won’t teach you how to
program from scratch — you should at least be familiar with basic programming techniques. If you
know what a
for loop is, though, you’re well on the way.
03_097748 flast.qxp 12/14/06 5:52 PM Page xix
xx
Introduction
As you work through this book, you’ll come across a wide range of different tools and technologies —
everything from AJAX to MySQL, from Greasemonkey to ImageMagick. You’re not expected to be an
expert in each of them — in fact, you’re not expected to know very much about them at all. As you go
through, you will find enough about each new piece of software or technology to enable you to easily
follow the examples and understand what is going on. Where possible, additional references are pro-

vided so that readers who want to pursue in more detail some of the topics covered can easily do so at
their leisure.
You’ll be using PHP for most of the examples shown, so a passing familiarity with PHP or similar script-
ing languages would be very helpful. If you’re not already familiar with PHP, all is not lost — PHP is a
pretty straightforward language and very easy to learn. If you’ve used other programming languages,
such as JavaScript, Perl, C++, or Java, the code in this book should present you with very little difficulty.
The documentation on the PHP web site at
www.php.net/ contains everything you need to bring you
up to speed.
Pretty much all the examples presented here are web-based, and so a working knowledge of basic
HTML and some familiarity with JavaScript is assumed. All the basics of setting up a web server and
PHP are covered in Chapter 3, so even if you’ve never looked under the covers of a web server before,
this book should tell you everything you need to get you started.
One chapter, Chapter 10, uses Perl. Even if you don’t know Perl, the code used is fairly straightforward and
most developers should be able to follow the example and get it up and running without any problems.
Again, you’re gently walked though the process of getting Perl installed and running on your computer, so
there’s really no excuse not to give it a try. If you really, really loathe it, however, the chapter is completely
optional — skipping it won’t spoil your enjoyment of the rest of the book in any way whatsoever.
What This Book Covers
In this book, you will be walked through a variety of ways to build software that interacts in some way
with Flickr. You’ll see how to use feeds to retrieve information, how to use Greasemonkey to change the
Flickr web site to suit your own needs, and how to use the Flickr API to build whole systems that use
Flickr as a source of information.
As this book is being written, Flickr is in what the developers call, in typical tongue-in-cheek fashion,
“gamma” status. Gamma is the next letter in the Greek alphabet after beta — so the implication is that
they consider the site to be out of beta, but still not ready for final release. In fact, a site like Flickr can
never be considered “final” — some things can always be improved and new features added. It is
inevitable that as time goes on, some parts of this book will grow dated — in particular those bits that
say things like “Flickr doesn’t do this yet.” Although some of the details may change, and newer and
cooler ways of building things will emerge, the basic principles covered in this book will remain valid.

The techniques you will see used here will stand you in good stead all the way through to Flickr omega.
It’s not only Flickr that changes over time — in this book you will use a wide variety of software pack-
ages, and those too can be expected to grow and evolve. If you want to catch up on the latest changes
made to either Flickr or the software packages used here, in particular with regard to how they may
affect anything you read in this book, you should check out my web site at
www.dopiaza.org/. You
will find information there about changes that have an impact on anything you read here. You’ll also
find some other Flickr remixes and mashups to play with. If you dig deeper, the site features also a
03_097748 flast.qxp 12/14/06 5:52 PM Page xx
xxi
Introduction
whole bunch of things that you are probably not the slightest bit interested in — including some great
recipes — but don’t worry, you’re not obliged to read those. The chicken with chili and nuts is pretty
good, though, even if I say so myself.
How This Book Is Structured
This book is very much about learning by doing. It includes many hands-on examples to help you
understand how things work, and each chapter includes one or more exercises to help you put all your
newly-learned skills to the test. Don’t worry if you get stuck, though — Appendix A contains full
answers to all of the exercises.
The book is divided into three parts. Part I, “Building a New Internet” is aimed at bringing you up to
speed with the world of mashups, and getting you ready to start building them. Chapter 1 talks about
remixes and mashups, and the differences between them. It describes the world of Web 2.0 and intro-
duces many of the technologies you will be using during the course of this book. Chapter 2 then takes
you on a short guided tour of Flickr — even if you’re already familiar with the Flickr web site, this chap-
ter helps identify some of the interesting bits from the mashup author’s perspective. Chapter 3 makes
sure that you are fully equipped to start developing your mashups. It walks you through the process of
setting up a development web server, and it shows you how to configure PHP and install Perl — by the
end of this chapter, you will have all the software you need in place, ready to start mashing. Part I con-
cludes with Chapter 4, “The Flickr API.” This chapter explains the main programmatic interface you will
be using to build the projects in this book.

Parts II and III are all about building software. In these sections you are guided, step-by-step, through a
series of software projects. Some of the projects are complete stand-alone applications, while others build
upon earlier projects to add new features. Each project introduces you to a new aspect of building
mashups with Flickr, guiding you through the process of creating your own working application. Part II
focuses on remixes — taking content from Flickr and presenting it on your own web site, or even chang-
ing the look of the Flickr web site itself by using Firefox and Greasemonkey. Part III concentrates on
mashing. In this section you will take content from both Flickr and a variety of other sources to build a
range of projects, from finding photographs to illustrate news feeds through to displaying your photos
on Google Maps. The final chapter of the book looks at some more advanced mashup techniques and
shows you how to use a local database to improve the performance and scalability of your software.
By the end of the book you will have built a variety of remixes and mashups, each building upon the
core services provided by Flickr, and you will be well prepared to embark on new mashup projects of
your own.
What You Need to Use This Book
All the software used in this book — web servers, PHP, Perl, ImageMagick, MySQL — is cross-platform.
Whatever your choice of computing environment, it is more than likely that you will be able to build the
projects described here. It is, however, impractical to give full instructions on how to set up every kind
of computer out there. The chapters that discuss installation and setup of software packages such as
Apache, PHP, Perl, and MySQL are written principally from the point of view of a user running
Windows XP Professional. Users of other variants of Windows will probably find their experiences
largely similar, but possibly subtly different.
03_097748 flast.qxp 12/14/06 5:52 PM Page xxi
xxii
Introduction
Linux users will find, on the whole, that all the software they need is already included within their
Linux distribution, and should consult their distribution’s documentation for instructions on how to
make sure that the necessary packages are installed.
All the software packages needed for the exercises in this book are also available for Mac OSX and,
wherever possible, additional notes are given to help you locate the necessary software and installation
and configuration information.

Conventions
To help you get the most from the text and keep track of what’s happening, we’ve used a number of con-
ventions throughout the book.
Tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this.
As for styles in the text:
❑ We italicize new terms and important words when we introduce them.
❑ We show keyboard strokes like this: Ctrl+A.
❑ We show filenames, URLs, and code within the text like so: persistence.properties.
❑ We present code in two different ways:
In code examples we highlight new and important code with a gray background.
The gray highlighting is not used for code that’s less important in the present
context, or that has been shown before.
Source Code
As you work through the examples in this book, you may choose either to type in all the code manually
or use the source-code files that accompany the book. All the source code used in this book is available
for download at
www.wrox.com. Once at the site, simply locate the book’s title (either by using the
Search box or by using one of the title lists) and click the “Download Code” link on the book’s detail
page to obtain all the source code for the book.
Because many books have similar titles, you may find it easiest to search by ISBN; this book’s ISBN is
978-0-470-09774-8.
Once you download the code, just decompress it with your favorite compression tool. Alternately, you
can go to the main Wrox code download page at
www.wrox.com/dynamic/books/download.aspx to
see the code available for this book and all other Wrox books.
Boxes like this one hold important, not-to-be forgotten information that is directly
relevant to the surrounding text.
03_097748 flast.qxp 12/14/06 5:52 PM Page xxii

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×