Categories
General

Auto-update an image every X seconds

For a web cam site I’m working on, I wanted to automatically update the web cam image every so often. The classic way to do this is with meta refresh, but that’s supposedly deprecated and it unnecessarily reloads the entire page. JavaScript to the rescue! This little snippet reloads any image with the “refresh” ID every 60 seconds. It’s mostly borrowed from here, with the setInterval thing added because I didn’t like the onload thing in the body tag.

function cambox_refresh() {
echo "n" . '<script type="text/javascript">// <![CDATA[
function refreshCam() {
image = document.getElementById("refresh");
image.src = image.src + "?rand=" + Math.random();
}                 setInterval("refreshCam()", 60000);
// ]]></script>'. "n";
}
add_action('wp_footer', 'cambox_refresh');
Categories
photos

Button repair

I’m not sure where we saw this – somewhere around DC I think.

Categories
photos

Sleeping between meals

Oscar takes a little nap.

Categories
photos

Little green helicopters

Maybe I’m easily entertained, but I’m tempted to stop and photo the Japanese maple in the front yard every time I walk by.

Categories
General

Photopress2 0.6

This version is a big update, so there are bound to be some bugs. The plugin now uses the WordPress taxonomy system for tags, and includes paging all over the album. There’s a tool for importing your tags into the new taxonomy.

The tag displaying template function now has more options:

<?php if (function_exists('photopress2_image_tags')) photopress2_image_tags($before='Image tags: ', $between=' ', $after='', $id=get_the_ID()); ?>

If you’re using the template function in your theme you should update that since the old version will display all of your tags…

Suggested upgrade steps:

  1. Deactivate and delete the old plugin.
  2. Unzip the new plugin, creating a “photopress2” folder in your plugin folder.
  3. Make sure your album page contains <!–photopress2_album–>
  4. Go to Photopress2 : Settings and verify your album page slug and other settings.
  5. Refresh your permalinks at Settings : Permalinks.
  6. Go to Tools : Import photo tags to import your Photopress2 0.4 tags.
  7. If you’re using the template function, update that.
  8. If you use a cache plugin, clear it.

Get Photopress2: photopress2.0.6.zip.