Use Flickr API and PHP to randomly post a Photostream Photo

This short PHP program will randomly select and display a photo from your Flickr photostream each time the page is refreshed.  This requires you to have the Phlickr module installed on your server, of course.  Your Flickr api keys should be defined in file authtoken.dat, and should have the format:


Use your own api_key, _secret, and _token in place of these (fake) ones.

You can see this script working at my web page



define(‘API_CONFIG_FILE’, ‘./authtoken.dat’);

include_once ‘Phlickr/Api.php’;
include_once ‘Phlickr/AuthedPhotosetList.php’;
include_once ‘Phlickr/PhotoList.php’;
#create an api object from the keys in file authtoken.dat

$api = Phlickr_Api::createFrom(API_CONFIG_FILE);

# Check to see if the logon is accepted

if (! $api->isAuthValid()) {
die(‘invalid flickr logon’);

# request a list of all your photos

$request = $api->createRequest(
‘tag_mode’ => ‘all’,
‘user_id’ => $api->getUserId()

# create a list object from the results of the search
$pl = new Phlickr_PhotoList($request, Phlickr_PhotoList::PER_PAGE_MAX);

# make sure some photos were found by the search
$count = $pl->getCount();

if ($count == 0) {
print “No photos could be found.<br/>”;

# select a random photo from the list
$rndPhoto = $pl->getRandomPhoto( );
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”&gt;
<html xmlns=””&gt;
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<body bgcolor=”#ffffff”>

<!– Create an image tag src by building an image URL from the random photo object –>

<img src=”
<?php echo $rndPhoto->buildImgUrl(‘-’); ?>

December 3, 2010 at 2:37 pm Leave a comment

I Buy a Kindle

So I finally broke down and bought an ebook reader – something I really didn’t need, but NEED doesn’t really enter into it when you’re a gadget-head.

I bought the $139 Kindle 3, which comes with wireless but no 3G. Being a computer professional (cough, cough) means I am bathed in wireless radiation almost 24/7, and since the Kindle memory will hold 3500 books (says Amazon), I figured the 3G was hardly worth the extra $50.

What can I say? I love the thing. Especially it’s ability to change the font size, which is especially important for proto-geezers like myself who wear bifocals. The contrast is perfectly acceptable, even in the semi-darkness of my bedroom, where much reading occurs.

The entire unit is about the same size as a trade paperback, and much thinner. It’s easy to hold in one hand, especially since I also bought the official Kindle cover (expensive at $35, but well-constructed).

The page advance buttons could be in better locations, but that is a minor kvetch. After using it for a while I was so comfortable that I caught myself attempting to turn pages instead of using the buttons.

The web browser is clumsy, since there is no trackpad or joystick. I tried it a few times, and the best you can say is that it works. I doubt if it will get much use. The voice which will read the text to you can be chosen as either male or female. Either one is pleasant enough, if mechanical. Again, this is a less-than-useful feature for me.

The issue of protecting copyright is a problem, as numerous copyrighted works are readily available on various bittorent sites (which I will not name here). The Kindle will display a variety of document types, none of which present a problem to the determined viewer.

Will ebook readers replace books? I can easily see them replacing non-collectible books, paperbacks, popular novels, computer books, and the like. At the moment I feel that ebooks and ebook readers are still too expensive. People who either require the convenience or have lots of spare cash will buy them, most others will wait.

October 20, 2010 at 6:52 pm Leave a comment

Update on the Google Books project

The Case Against Google Books

How three East Bay librarians led the revolt against the company’s plans to archive all earthly knowledge.

By Chris Thompson

October 14, 2009

Google has empowered ordinary citizens beyond anything once thought possible. Thanks to Google, you can view your home from space, track flu outbreaks around the country, or figure out traffic congestion along your commute route, all instantaneously and without spending a single dime. And the company’s motto, “Don’t Be Evil,” underscores an undeniable civic-mindedness. Its nonprofit arm,, invests in green electricity start-ups. Goats graze the company’s lawns to reduce its carbon footprint. And yet, despite the company’s best efforts, there’s just something about Google that gives some people the heebie-jeebies.

October 16, 2009 at 6:40 pm Leave a comment

NYT Article on the Google Books Project

Since my employer is a partner in this project, I link here to the latest NYT article.

February 3, 2009 at 2:15 pm Leave a comment

E-Books…the long sad story…

A history of the E-book, from Ars Technica.  An interesting analysis from someone who’s been in since the beginning of the format.

February 3, 2009 at 2:11 pm Leave a comment

Windows Vista Sidebar Gadgets are Pretty Pointless

…and yet I wrote one anyway, just to try it out: App Killer

October 21, 2008 at 1:11 pm Leave a comment

Stopping VirusRemover2008

Once again some major fool has created more work for me…this time, a client intemperately clicking a link in’s comment section has installed an app called ViruRemover2008, supposedly an antiviral program, but in reality an annoying piece of malware.  Pop-ups continually distract you indicating that there are viruses on your computer.  To ‘fix’ this problem, you are advised to purchase the full version of VirusRemover2008.  VR2008 will never stop asking you, and will not allow itself to be uninstalled.  This is a business model?

So I spent some time trying to remove the program fragments in the manner suggested at, but I never did find them.  SAV might have found and deleted them by the time I arrived on the scene, or the VR2008 author may have read the same page and changed his code.  The virus was only active in a single user’s profile, so the actual fix was:

  • let Symantec AV do its thing
  • copy the user’s profile
  • delete the user’s profile
  • after making sure the problem is gone, restore the user’s desktop items and internet favorites.

So far, that has worked.  Try not to get too angry.

October 8, 2008 at 4:57 pm Leave a comment

Older Posts

April 2014
« Dec    

iPod Today

Musicophilia - Oliver Sacks


Get every new post delivered to your Inbox.