Chumby Widget: PhotoFrame

I’ve created my first Chumby Widget, a photo viewer for pictures hosted on your web server. They can be located either in a directory on a public server or a private one inside your personal network, so you can use the widget to display private images without having to publish them or upload them to a third-party image hosting service. With a little more effort, it is also possible to store the images on a USB drive plugged into your Chumby - go here first if that’s what you prefer.

Otherwise, here’s how to set it up:

1) On your web server, create a directory and place your images (jpg or png) inside. If they are larger than 320x240, the widget will scale them down automatically, but you might want to consider scaling them down manually to save space and network traffic.

2) Create a file called “images.xml” inside that directory, containing a list of the images in the following fashion:


  <images>
    <image filename="image1.jpg" />
    <image filename="image2.jpg" />
    <image filename="image3.jpg" />
  </images>

If you only have images in JPEG format, running this simple shell script inside the directory will create the XML file for you:


  #!/bin/sh
  echo "<images>" > images.xml
  for files in *.jpg
  do
    echo "  <image filename=\"$files\" />" >> images.xml
  done
  echo "</images>" >> images.xml

3) Place a file called “crossdomain.xml” inside the root of your web server with the following content:


  <?xml version="1.0"?>
  <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
  <cross-domain-policy>
     <allow-access-from domain="*.chumby.com" />
  </cross-domain-policy>

This will allow the flash code of the widget to access data on your web server (more information on this can be found here). Apparently, this is also required on a local server.

4) Install the widget as usual via the Chumby Network.

5) Use the configuration widget to set the delay (i.e. the duration in milliseconds you want each image to stay on screen) and the URL to the directory you created in step one, without the trailing slash (for example, “http://www.example.com/chumby/images”). If you don’t want to have the current file name displayed, simply type “no” into the third text field.

6) If you like, you can download the source code here; the script and example crossdomain.xml mentioned above are included as well; the license is GPL (version 2 or later).


Troubleshooting:
If PhotoFrame doesn’t display any images, point a web browser to one of them; if you get an error, check the URL and the files’ permission settings. If it’s being displayed correctly, check your images.xml for syntax and make sure that the crossdomain.xml is valid and sitting at the root directory of your web server.

For testing, you can point the widget to the following URL:
“http://www.discarded-ideas.org/files/photoframe-test”


Enjoy!

Comments

Problems

I have tried both: rserver.rothman.dnsalias.com/chumby and http://rserver.rothman.dnsalias.com/chumby with no success on either. I can load the xml in a web browser http://rserver.rothman.dnsalias.com/chumby/images.xml no problem but still no picures (I can show them individually as well. Any thoughts?

Problems

This is often a problem caused by Flash access restrictions; check your crossdomain.xml for correctness and make sure it’s in the root directory of your web browser. I’ve added a troubleshooting section to the article including an example URL for testing. Try pointing the widget on your Chumby to that - if you can see a bunch of demo images, it’s most likely a server-side issue.

How many photos can your widget cope with

Seems to work fine if I keep the number of photos to a maximum of 100 or so but not beyond that. If you would like try pointing a chumby at http://rserver.rothman.dnsalias.com/chumby

How many photos can your widget cope with

I’ve tested it with ~50 pictures on an external web server, ~200 pictures on a server inside my local network and ~850 pictures on a USB drive and I haven’t had any problems with either configuration. The images were mostly scaled down to 320x240 pixels and between 50-100KB in size.
I’m currently testing it with your pictures, no problems so far.
By the way, having the images spread across different subdirectories should work fine if this is properly reflected in the images.xml file. I haven’t tried it, though.

Seems to be a slow down in the chumby at around the 5000 mark

So I left the chumby alone with the xml file for about 10 minutes and it loaded 4750 images. Trying now with 6600 (the number I have). The subdirectory thing works fine. My comment re subdirectories was with regards to the sample script you gave for generating the the images.xml file. Hence my little Windows App. Thanks for your assistance. I am trying to understand the inner workings of the chumby and flash and messing with this has been a real help.

Not Working

Hi there,

I love the idea here but just can’t get it working (just get the default photo).

I’ve got the 2 XML files (and can see them from remote PC’s) so there isn’t a permissions issue but nothing appears.

Text is as per your instructions (can post here apparantly).

it just sits on Loading http:///chumby/images.xml which is correct. Any help greatly appreciated.

Richard

Not Working

Does it really show three slashes after the colon? Because that doesn’t look quite right…
The problem you describe usually occurs when one of the XML files cannot be found; looking at your web server’s log messages might help.
Note that the crossdomain.xml file needs to go into the root directory of your web server, not the image directory. Your URL implies that the host name of your web server is “chumby” and you put all the images and both XML files into the root directory. I’ve never tried that (always used a sub-directory for the images) but I can’t imagine why it shouldn’t work.

Three slashes...

The three slashes would indicate no host at all. (Two slashes, followed by no hostname, followed by the root slash.)

If that’s the URL actually put into the config dialog, I would guess the widget would default to the localhost, which isn’t going to work if the Chumby isn’t running a web server.

Anyway, that’s my guess.

Best photo widget by far!

I just love this widget. It’s very stable. (Been running it for hours with no problem.) And it lets me use it as a photo frame without having to upload a bunch of tiny images to Flickr. (Or, else deal with potentially poor scaling and slow speeds with large files.)

My only two suggestions are:

1) Have the screen go black between photos, rather than white. Or some other sort of transition, I guess. I’d be very happy with just a black screen.

2) Right now, it appears to truly pick photos at random, which means a single photo can show up three or four times before some other photo shows. I’d rather see it show them randomly, without repeating, until they’re all shown. Then start over.

But, frankly, it’s great as it currently is.

Best photo widget by far!

Glad to hear that the widget is useful to you.
About your comments:

1) Agreed, I’ll address this in the next version.

2) I liked the truly random way because I usually have the PhotoFrame widget stay on screen but I don’t constantly watch it, and this way, I cannot miss a picture. However, it seems that some pictures really show up a lot more often than others. Maybe I could make this configurable.