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');
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:
- Deactivate and delete the old plugin.
- Unzip the new plugin, creating a “photopress2″ folder in your plugin folder.
- Make sure your album page contains <!–photopress2_album–>
- Go to Photopress2 : Settings and verify your album page slug and other settings.
- Refresh your permalinks at Settings : Permalinks.
- Go to Tools : Import photo tags to import your Photopress2 0.4 tags.
- If you’re using the template function, update that.
- If you use a cache plugin, clear it.
Get Photopress2: photopress2.0.6.zip.
This update corrects WP_DEBUG warnings in Birthdaze, mostly in the widget. If you’re using the widget you’ll need to reconfigure it due to the changes. This version also adds an option to display the next week’s birthdays. The “thismonth” option in the shortcode and template function is now called “time” and should be set to “all,” “month,” or “week” depending on what you want to display. The readme.txt file should be up-to-date if you need more information.
Get the latest version of Birthdaze here: birthdaze.0.5.zip.
Titlematic is a simple plugin that gives title-less posts a title. This version adds an options page to configure the automatic title length, the character after the automatic title, and the fallback title text. It’s also now hosted at the WordPress plugins repository for easy upgrades.
Get Titlematic 0.2 from the WordPress Plugin Directory.
Update: If you auto-upgrade from 0.1, the old version may not be deleted and the new version may not be activated. If so, you’ll need to deactivate and delete 0.1, then activate 0.2.
This version fixes more bugs uncovered by WP_DEBUG and adds a way to import Flickr images into the Media Library. When you’ve clicked through to a photo, if your user has upload permission there’ll be a link at the bottom of the popup to import the image as an attachment to the current post. Then you can use the imported image as you would any other attachment, such as for the post thumbnail or featured image. Please only import images when you have permission to do so!
Get flickpress 1.9.2 at the WordPress Plugin Directory or by upgrading as usual in your WordPress admin panel.
Update: I installed a derivative of Twenty Ten so you can sorta see the image import feature in action. I imported a photo of a leaf and set it as the featured image for this post, so if you’re viewing this post by itself you should see that as the header image.
WordPress 3 has a neat new check during plugin activation that generates a scary notice if the plugin generates any “unexpected output.” Sadly, the current version of flickpress was generating the scary notice. WordPress doesn’t provide any of the unexpected output and Apache’s error log wasn’t very enlightening either. I started deactivating, commenting out code blocks, then reactivating. It turned out the issue was in the table installation function. I was using this deprecated code:
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
…which should be this instead:
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
So, if you’re having trouble tracking down the source of this notice in your own plugin, carefully check everything it’s doing during activation.
This release adds one big feature, refines a few things introduced in the last release, and fixes some bugs.
First the bugs: A discussion about WP_DEBUG on the wp-hackers list inspired me to turn it on track down the avalanche of warnings, notices, and errors that flickpress was causing. Actually, it wasn’t that bad and fixing the issues didn’t take long. The major change was in the widget code – I was still using pre-2.8 widget functions. So, if you’re using the widget you may will need to check re-enter your settings. I also found and fixed a few breadcrumb problems in the popup tool.
Refinements: Thanks to some feedback from Gustav, I changed the before/between/after caption text fields to allow HTML. This can be used for a variety of things, such as breaking the caption into two lines or wrapping the caption with a tag to use custom style. The last version added simple ThickBox lightbox support, but in case you wish to use another lightbox method I added a custom lightbox option that works with plugins like LightBox Plus.
New feature: On the settings page you can now specify default licenses for photo searches. This will save you a few clicks if you always search for photos licensed the same way.
Get flickpress 1.9.1 at the WordPress Plugin Directory or by upgrading as usual in your WordPress admin panel.
This update adds a bunch of options to customize the appearance of embedded Flickr images and their captions. Here’s what you can do now:
- Specify classes for the container div and image to control their layout/appearance.
- Change the order of the title and author in the caption, or omit the author from the caption.
- Specify text (including HTML) to insert before, between, and after the caption elements.
Get oEmbed FlickrLinkr 0.4 at the WordPress Plugins Directory.
Here’s an example with aligncenter on the div and some HTML in the text at the start of the caption (might change if I change the settings later – that’s how oEmbeds work):
This update adds some caption options, ThickBox support, moves the widget into the main plugin, and updates the phpFlickr library to 3.0. The new caption options let you switch the order of title and author, and put arbitrary text before, between, and after the caption parts. I moved the widget into the main plugin, so you may need to make sure it’s still in your sidebar. If you enable ThickBox support in the options then clicking an inserted Flickr image will display the largest image size available (up to Large) in a ThickBox window.
The plugin should work with the latest version of WordPress, currently 3.0.
Get flickpress 1.9 at the WordPress Plugin Directory or by upgrading as usual in your WordPress admin.
oEmbeds make it ridiculously easy to embed content from other sites in blog posts. Unfortunately, Flickr oEmbeds are not linked to Flickr by default, which seems silly and probably violates Flickr’s Community Guidelines. This plugin enhances your Flickr oEmbeds by linking to the photo page at Flickr and optionally adding a caption with the title and author.
Get oEmbed FlickrLinkr 0.2 at the WordPress Plugins Directory.