Create a folder called 'cache' in your web directory and give it writable permissions (CHMOD 777). Before anything else, we need to create a cache folder in order for phpFlickr to work properly. These code examples are all working on the basis that your files are on the root of your server - or all in the same folder. All of the code will be available as complete pages at the end of the tutorial. We'll make two pages: one to show our thumbnails and one to show the photo. Now we have all we need to connect with Flickr and retrieve our photos. Upload the files to your web directory Step 3 - Basic Setup and Simple Configuration For this tutorial, we only need the PEAR folder and the phpFlickr.php file. In this demo, we'll be using the zip file: phpFlickr-2.3.1 (zip)ĭownload and unzip it. Visit or skip straight to the download page at Google Code. We need to download the files that we will later include in our webpage, and will do all the complicated work for us. The files process the data provided by Flickr and return arrays in PHP, which we use to display our photos It is a class written in PHP which acts as a wrapper for Flickr's API. Pay particular attention to the tips and advice given in the API Terms of Use and the Community Guidelines, if you abuse it, you'll lose it. You can click on 'Edit app details' to fill in the info. If you use the API to build a cool tool or site later on, you might want to submit and feature whatever you build in the Flickr App Garden. For this exercise we only need the key make a note of it as we'll need it soon. You'll also see a number called 'Secret ' ignore that for now. ![]() You should then be presented with your unique key which will appear as a series of random numbers and letters like so: Flickr provide good explanations as to which you should choose, chances are you'll need a non-commercial API key, which is what I am choosing for this demo.įollow the steps and fill in all your details. Here you must decide if you are going to use Flickr for commercial or non-commercial purposes. Your API key is your own unique series of numbers and letters which grant you access to Flickr's services. Make a photo page to show our photos (with previous and next navigation).Build a gallery page to display our thumbnails (with pagination).Once you get to grips with using the API, you can let your imagination conjure up a new way to use it and submit your app.įor this tutorial I am presuming that you already have a Flickr account, and access to a server that runs PHP and PEAR. Flickr have also recently launched The App Garden, which is a showcase of tools, toys and sites which use the Flickr API to offer something useful or fun.
0 Comments
Leave a Reply. |