|< Day Day Up >|
Hack 51. Browse the World Wide Photo Album
Take a random stroll through the world's photo album using some clever Google Image searches (and, optionally, a smidge of programming know-how).
The proliferation of digital cameras and growing popularity of camera phones are turning the Web into a worldwide photo album. It's not only the holiday snaps of your Aunt Minnie or minutiae of your moblogging friend's day that are available to you. You can actually take a stroll through the publicly accessible albums of perfect strangers if you know where to look. Happily, Google has copies, and a couple of hacks know just where to look.
3.5.1. Random Personal Picture Finder
The result, shown in Figure 3-3, is something like looking through the world's photo album: people eating, working, posing, and snapping photos of their cats, furniture, or toes. And since it's a normal Google Images search, you can click on any photo to see the story behind it, and the other photos nearby.
Figure 3-3. The Random Personal Picture Finder
A smidge of Python illustrates just how simple it is to generate a link to some random collection of photos shot with a Canon digital camera:
$ python Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from random import randint >>> linkform = 'http://images.google.com/images?q=IMG_%s.jpg' >>> print linkform % str(randint(1, 9999)).zfill(4) http://images.google.com/images?q=IMG_7931.jpg
You can easily use this as the basis of a CGI script that acts in the same manner as the Random Personal Picture Finder does.
And if you think the Random Personal Picture Finder is fun, you'll love Jamie Zawinski's WebCollage (http://www.jwz.org/webcollage/), a Perl script that finds random pages, strips them of their images, and puts these images together to create a collage. The collage is remixed and added to once a minute, your browser reloading a fresh version every so often (or just hit Shift-Reload on your browser yourself to speed up the process). Figure 3-4 shows a WebCollage snapshot in time.
Figure 3-4. A typical WebCollage snapshot of random pictures gleaned through Internet search
Click on any one element and you'll be taken to the page that the image is from.
You can grab the Perl source (http://www.jwz.org/webcollage/webcollage) and generate a page similar to Jamie's like so:
$ webcollage -size '800x600' -imagemap ~/public_html/collage
where 800x600 is the size and ~/public_html/collage is the path to and file you'd like to save the image map as.
WebCollage is also included in Zawinski's XScreenSaver (http://www.jwz.org/xscreensaver), a screensaver system for computers running the X Windows System (usually some brand of Unix).
|< Day Day Up >|