oncolour - a simple PHP script to display a photo from Flickr on a specific background colour
URL: http://www.poirrier.be/~jean-etienne/software/flickr/oncolour.php
Text written on July 23rd, 2007 (no modification yet)
Introduction
oncolour is a simple PHP script. It allows you to display your photos from Flickr on your own website and with a specific background colour. Some other solutions have been developed and used but this one is really free: free for use (see below how to use it) and free to re-use (see below how to download the script and use it on your own server.
Screenshot

Created using this URL: http://www.epot.org/flickr/oncolour.php?id=860125589&desc=false&size=medium&col=black, i.e. (in the argument order) showing Flickr photo ID 860125589 (from me) without description, with a medium size and a black background colour.

Created using this URL: http://www.epot.org/flickr/oncolour.php?id=863428195&desc=true&size=medium&col=white&bord=1, i.e. (in the argument order) showing Flickr photo ID 863428195 (from adulau) with description (and title), with a medium size, a white background colour and a border around the photo.
Usage
The script is rather simple to use. For the moment, you can freely use it from its epot.org location ...
The script uses some parameters with only 1 mandatory one (id):
- id: the photo ID on Flickr. You can easily find this ID of a photo you like/own on Flickr: it's the 9-digits number at the end of the web page URL, between slashes. For example, the ID on this page "http://www.flickr.com/photos/jepoirrier/860125589/" is "860125589". This is the only mandatory parameter.
- col: the background colour, one of the 16 basic colours in the table below. By default (anything else than numbers between 1 and 16 or these colour words), it will be black. Text colour is automatically chosen: black if background is light ; white if background is dark (see table)
- desc: if you want the description to be shown (if the photo's author did not put a description, the script cannot invent one!). Values like "0" or "false" will not display the description ; "1", "true" (or anything else) will display the description. By default (no mention of desc), there is no description.
- bord: if you want a border around the photo. Values like "0" or "false" will not display the border ; "1", "true" (or anything else) will display the border. By default (no mention of bord), there is no border. The border colour is the same as the text colour (so: white on dark background or black on light background).
- size: one letter or a complete word defining the size of the photo. Please note that these letters are different from the official Flickr size suffixes. See the ad hoc table below for description. Default size is medium (500 pixels on longest side). Some size may not be available for some photos, depending on the original size uploaded.
Parameter order has no importance.
| # | Colour preview | Colour name | HEX value | Text colour |
|---|---|---|---|---|
| 1 | white | #FFFFFF | black | |
| 2 | yellow | #FFFF00 | black | |
| 3 | fuchsia | #FF00FF | black | |
| 4 | red | #FF0000 | white | |
| 5 | silver | #C0C0C0 | black | |
| 6 | gray / grey | #808080 | black | |
| 7 | olive | #808000 | black | |
| 8 | purple | #800080 | white | |
| 9 | maroon | #800000 | white | |
| 10 | aqua | #00FFFF | black | |
| 11 | lime | #00FF00 | black | |
| 12 | teal | #008080 | black | |
| 13 | green | #008000 | white | |
| 14 | blue | #0000FF | white | |
| 15 | navy | #000080 | white | |
| 16 | black | #000000 | white |
| One letter | Full word | Comment | Flickr suffix equivalent |
|---|---|---|---|
| s | small | 240 pixels on longest side | _m |
| m | medium | 500 pixels on longest side (default value) | (none) |
| l | large | 1024 pixels on longest side | _b |
| o | original | original image/size | _o |
Build your own page, based on the epot.org file! For that, use this base URL: http://www.epot.org/flickr/oncolour.php? and then add your parameters, at least an ID. So the minimal URL would be: http://www.epot.org/flickr/oncolour.php?id=860125589 e.g. Add other parameters separated by the "&" sign. For example: http://www.epot.org/flickr/oncolour.php?id=819859740&desc=true&bord=true&col=grey. Try different variations :-)
Software
If you prefer to run this file on your own server, you can download the latest version of oncolour.php (Gzip file, 2.1ko). You'll need your own Flickr API key in order to run this software; you can get your key here for free. Once you got yours, simply put it in the code (for variable $FAk on line 20).
The link above gives you a Gzip file containing the PHP (the file you'll use). You can run this software on any webserver running at least PHP version 4.0. Tests and production file is on a server running Apache httpd and PHP 4.
This software is released under the GNU General Public Licence (GPL): you can modify it (but your modifications should stay with this licence).
Copyright (C) belongs to Jean-Etienne Poirrier, 2007. You can contact me at jepoirrier "at" gmail.com. Please report if you have any problem, comment or if you would like new features in this software.
Save this page in del.icio.us