Blog Menu

Admin

Darkroom for Wordpress

About

Darkroom is a plugin I wrote for my own blog and thought other people might like to use in their blogs. I’ve tried to build in some flexibility as well as ease-of-use, but there are always compromises. I look forward to your feedback so I can make it better. To contact me about the plugin please use darkroom@innerturtle.com so that I know what your e-mail is about.

Unless this plugin suddenly becomes wildly popular, I will do my best to support it. There is no planned date for the next release, but see the information about future enhancements below. This plugin works fine with the default theme — I may not be able to help every person make Darkroom work for their favorite theme.

Features

  • Captions are loaded through EXIF/XMP tags. You just upload your pictures and go.
  • Use of lightbox through the slimbox plugin
  • The ability to list different “galleries” either in your sidebar or directly in the page content.
  • Complete control over where your gallery appears.
  • The ability to watermark your pictures for copyright purposes.
  • Most customization is done through the regular WordPress admin page.

New Features in Version 1.1

  • A new option has been added for “Sidebar Title.” This replaces the option in the darkroom_sidebar function. The installation section has been updated below. (The readme.txt in the old version has the correct information for that version.)
  • Added experimental “widget” support. You should have the option to use the Darkroom sidebar widget if you use widgets to customize your sidebar. Please note: If you use the widget, it will display in your sidebar any time the darkroom content is displayed — even if the “Use Sidebar for Navigation” option is set to No. It’s strongly recommended that you turn “Use Sidebar for Navigation” option to “on” if you’re using the widget.

Requirements

As far as I know, only WordPress 2.6 or above is required. I don’t know if older versions would work or not.

Limitations/Future Enhancements

  • Right now you must include a watermark. The watermark always starts with © and there’s no way to control the color/position. These will all be customizable in the future.
  • Although multiple file types are supported, only JPG files support EXIF so only these files can have captions. (Date/time stamps for non-JPG files are based on the filesystem’s timestamp.) Because this plugin is designed for drop-and-go use, no changes are planned for this in the future.
  • Right now there’s no way to add/edit/remove captions once the files are uploaded. EXIF/XMP tagging in PHP is harder than it sounds. I’m investigating if this is a good idea or not and considering where the UI for this feature would go, if it were added.
  • Sometimes the thumbnails don’t render completely. A refresh of the page will usually do the trick. This seems to usually happen the first time a folder of pictures is accessed. I’m looking into this.
  • The main gallery isn’t very efficient if you’re not using the sidebar navigation.
  • I totally intend on making a stylesheet for this plugin. This will clean-up all the embedded CSS in the HTML, which is bad/ugly, and also make it easier for people to change the formatting themselves.

Download

You can get Darkroom by clicking on the following link: darkroom at wordpress.org.

Installation

Basic Installation

  1. Download the source, uncompress it, and put the darkroom folder in your WordPress plugins directory.
  2. Create a folder called “pics” in the root of your WordPress installation. Create sub-folders and put pictures in them.
    For Example:
    1. My blog is located at /usr/web/innerturtle.com/. I can access this via FTP.
    2. I created a new folder called pics. It lives at /user/web/innerturtle.com/pics/. This will be the place where darkroom gets all the pictures. But wait, I can’t put any pictures files into this folder SO…
    3. I create subfolders, maybe “BirthdayPictures” and “HikingPictures”. These would live at /user/web/innerturtle.com/pics/BirthdayPictures/ and /user/web/innerturtle.com/pics/HikingPictures/ respectively.
    4. I put my birthday pictures in /user/web/innerturtle.com/pics/BirthdayPictures/ and I put my hiking pictures in /user/web/innerturtle.com/pics/HikingPictures/.
    5. Now Darkroom will show that I have two “collections”: one of birthday pictures and one of hiking pictures.
  3. Go into your WordPress Admin Console and create a new page. The name of your page is as it will appear on your site (unless you change this, see below.) You must enter a custom field: make the KEY of darkroom and the VALUE of true. These values are case-sensitive. See the examples where the red arrows are pointing here.
  4. View your new page. If you’ve done the previous steps correctly, you’ll see a photo album.

Advanced Customization

  1. Use the database cache. Go into the Darkroom settings and turn on both Use Database Cache and Create/Recreate Database Table. If you only turn on the first option, it will automatically turn-off because there is no database table to use.
  2. Use a sidebar. Turn-on the Darkroom setting for Use Sidebar for Navigation. Then, put the following code in your sidebar.php file in your theme.
    <?php darkroom_sidebar(); ?>

    There are several parameters available for this function: darkroom_sidebar($include_timestamps = TRUE, $head_name = ‘Picture Galleries’, $is_item = TRUE, $title_before = ‘<h2><em>’, $title_after = ‘</em></h2>’, $list_class = ‘categories’)

    1. $include_timestamps (TRUE) - whether to include the timestamp for each collection in the list in the sidebar. This doesn’t work well with all themes.
    2. $is_item (TRUE) - whether the sidebar entries should be surrounded in a <li> tag. This varies from theme to theme.
    3. $title_before (’<h2><em>’) - this is what to put before the sidebar heading/title.
    4. $title_after (’</em></h2>’) - this is what to put after the sidebar heading/title.
    5. $list_class (’categories’) - this is the class to make the sidebar list, which may vary from theme to theme.

    Once you get the sidebar working, you may want to supress some of the other sidebar content. Also see “Customize Your Theme,” below, for the functions you can use to do this.

  3. Enable the footer. First, put the following code in your footer.php file in your theme.
    <?php darkroom_footer(); ?>

    There are two parameters available for this function: darkroom_footer($before=”, $after=’<br />’)

    1. $before - this is what to put before the footer text.
    2. $after - this is what to put after the footer text.
  4. Customize your theme. There are two approaches:
    1. Use the WordPress is_page() function. For example, my page is called pictures so I could write test against is_page(’pictures’).
    2. Use the Darkroom function is_darkroom(). This function does not take any variables.

    For example, most themes include the page name at the top of the page. This just messes up the flow of Darkroom. You could change a line in your theme’s page.php to read something like this:

    <?php if (!is_darkroom()) { ?><h2><?php the_title(); ?></h2><?php } ?>

Remember, most of your advanced customizations need to go into your theme, so if you ever switch themes you’ll have to do some tweaks to get your Darkroom looking like you think it should.

Trivia

If you look at my source code, you will see that many things use the abbreviation JPG. This actually stands for Jed’s Photo Gallery, which was the temporary name for the plugin until I settled on “Darkroom.”