Tuesday, February 15, 2011

Flickr

Well, it has been a while since I have added anything to this blog. I have recently tried using php to create a travel journal for Flickr. I have recently added a serious of landscape photographs and I wanted to make some sort of php-based viewer. I got sidetracked by several irritating things that I am going to write here because I am sure that I will forget which notebook I wrote them down in (linux from scratch notebook).

So, to start, I am working with Ubuntu 10 and apache/php.  First, I added ServerName=localhost to the httpd.conf file, to get rid of that message about "reliable determination". Then I changed all the permissions until I removed the 403 error. I ran into an odd php problem with my subdirectories, where files with the name index.php were being opened by an editor instead of in the browser. Actually, it turns out that I just had a few typos (symbols outside of html tags) that for some reason were preventing proper opening of the webpage.

I am using  phpflickr as described by Paul Burgess in his tutorial. I am still using the 3.0 version so that I can follow the tutorial. Since I asked for an API key awhile ago, I went in search of where I might find it. (you-> your account->sharing and extending ->your API keys, at the bottom). I have two of them but will use the one associated with my landscape photos. This I put key and ID into the config.php file. I am asked to upload this, but since I am working on Apache  localhost, I should just leave it in the working directory.

The tutorial is a bit unclear in some places, especially since I unpacked the code  a few months ago. The thing that surprised me is that the php code started at the top and the html code followed underneath. For the first tutorial, there is index.php, which calls phpflickr.php and config.php. Opening index.php in the browser produces a grid of thu http://localhost/vacation_2010/index.phpmbnail photographs. Nice. This is the address:

 http://localhost/vacation_2010/index.php

When I click on one image, a larger image appears with  paging through the gallery, this appears in the web address window:

http://localhost/vacation_2010/photo.php?id=5416188716

I think that I will have to scale the images because they are quite large. But this is already a nice success.

Made by index.php
Made by photo.php

1 comment:

  1. Phpflickr only reads the first 20 photos (from a set of 62) and sorts them in a time linear fashion. (i.e. The first photo seen is the last photo of the sequence.) I need to be able to specify the Flickr "set" in order to separate the photos in a logical order. I am going to have to understand this a lot better to get it to do what I want. But I am happy to get started.

    ReplyDelete