PhotoQ WordPress Photoblog Plugin v1.2 – Ready for WordPress 2.5
In a few hours, version 2.5 of WordPress will be released. Here is already an update of the PhotoQ WordPress photoblog plugin which will make it compatible with WordPress 2.5. This is one of the biggest updates PhotoQ has seen so far, so it is recommended to update. For those who don’t know yet, PhotoQ is the WordPress photoblog plugin that makes your photoblogging life easier. It is most suited for “one photo a day”-style web pages i.e., classical photoblogs.
With PhotoQ you can mass upload several photos at the same time thanks to its batch upload functionality. PhotoQ places uploaded photos in a queue which gives you a convenient way to manage photos to be posted. The plugin then gives you the possibility to have the top of the queue automatically posted at a given interval. In short, PhotoQ was designed to automate and simplify your photo posting process as much as possible. It takes away the hassle of browsing uploaded image files and embedding them into posts: You simply upload your photo to the queue and enter desired information about the photo. PhotoQ then automatically generates the post based on this information.
An example of a photoblog running on WordPress and PhotoQ can be found at http://www.whoismanu.com.
- Queue-based photo management
- Batch upload photos to your photoblog
- Hassle-free, fully automated posting of photo posts
- Possibility to add custom metadata to photo posts
- Automatic thumbnail generation
- Automatic posting through cronjobs
- Integrates with Lightbox, Shutter Reloaded and similar libraries/plugins
The biggest changes in this version of PhotoQ happened under the hood and are thus only indirectly visible to the end-user. Nevertheless, there are some visible neat new features like, e.g., drag-and-drop queue reordering.
- Compatible with WordPress 2.5
- New batch upload script for greater stability
- Ajax Queue Management
- Lightbox integration
PhotoQ is somewhat experimental and I consider it nowhere near of being perfect. Still, I think that PhotoQ can be useful to someone who tries to set up a photoblog with WordPress and that’s why I decided to make it public. However, I take no responsibility of what might happen if you choose to use it: You use PhotoQ at your own risk. On the other hand, do not hesitate to ask questions concerning PhotoQ if you get stuck – I would be glad to help.
PhotoQ 1.2 has been tested successfully under WordPress 2.5 and 2.5.1. Note that due to a change in how WordPress handles categories, you need to update to WordPress 2.5.1 if you want to use PhotoQ versions 1.2.5 and higher. So, if you are running WordPress 2.5, just download PhotoQ 1.2.4 and it will run just fine.
No version of PhotoQ 1.2 runs on any WordPress versions < 2.5 and it never will. If you need to run PhotoQ with WordPress < 2.5, download version 1.1.5b of the plugin. Note however that I stopped developing the 1.1 branch, so there will be no updates in this case.
PhotoQ has been tested with both, PHP4 and PHP5. At the moment PhotoQ only runs on web servers with PHP safe_mode turned off. If your web hosting provider has safe_mode turned on you can try to ask them to turn it of. Most web hosting providers will disable safe_mode for your web page on request.
- 15.07.2008 – 1.2.6: Compatible with WordPress 2.6.
- 06.05.2008 – 1.2.5: Category handling adapted to WordPress 2.5.1. Two new settings to choose default category and author of PhotoQ posts.
- 22.04.2008 – 1.2.4: Bugs fixed: Problems with filenames containing special characters; Disappearing Media Library update links in Write panel caused by PhotoQ.
- 16.04.2008 – 1.2.3: Bugs fixed: PHP4 compatibility restored, no more lost settings; Now compatible with localized WP versions, no more “swfu not defined”. Now also compatible with IE7; SWFUpload updated to 2.1.0b2.
- 04.04.2008 – 1.2.2: Bugs fixed: Ajax queue ordering did not work if dashes present in filenames; Header of queue no long sortable; Correct authentication of Ajax queue manipulations; Cookies no longer sent during Ajax calls.
- 15.03.2008 – 1.2.1: Fixes a bug that could under some conditions provoke empty width and height attributes
- 09.03.2008 – 1.2: Compatible with WP 2.5. Migrated batch uploads to SWFUpload 2 for greater stability. Ajax Queue Management. Lightbox Integration. Runs on Reusable Options.
- 25.11.2007 – 1.1.5b: PhotoQ is now able to truly resize photos. It now also integrates with existing themes more easily because of the new option to directly include the description in the post content. Category display bug when updating queue has been corrected.
- 07.11.2007 – 1.1.4b: PhotoQ is now again retro-compatible with WordPress versions that do not have built-in tagging support. Only update if you use a WordPress version prior to 2.3.
- 04.11.2007 – 1.1.3b: PhotoQ now supports WordPress’ native tag handling introduced in WordPress 2.3. Please read this post to see how to import tags from meta fields to the new structure.
- 20.10.2007 – 1.1.2b: changed require_once statements so that the plugin also runs on web servers that don’t like relative paths in these statements. Update only if you encountered problems with version 1.1.1b.
- 17.10.2007 – 1.1.1b: “Largest Side” image/thumb-size option is now a “Smallest Side” option. “Largest Side” can still be mimicked by setting both values in the “Maximum Dimensions” option equal to the desired value.
- 14.10.2007 – 1.1b: first major update. Features mass uploads via SWFUpload. New options for image/thumbnail sizes. Better photo preview in admin section. Enhanced security due to use of wp_nonces. Under the hood, big parts of the code have been restructured.
- 07.10.2007 – 1.0.2b: patch to make it compatible with WordPress 2.3.
- 22.01.2007 – 1.0.1b: fixed a bug that caused PhotoQ to handle some paths and urls improperly. Anyone wanting to use PhotoQ should update to this new version.
- 11.01.2007 – 1.0b: first public release.
- Get the latest version of the PhotoQ WordPress Photoblog Plugin (WP 2.6). (PhotoQ for WordPress 2.5.1)
- Unzip the downloaded file, you should end up with a folder called “photoq-photoblog-plugin”.
- Open this folder, you should see a folder called “whoismanu-photoq” and a file called “wimpq-cronpost.php”.
- Upload the “whoismanu-photoq” folder to your “plugin” directory (wp-content/plugins).
- If you plan to use the automatic posting capability, save the file “wimpq-cronpost.php” in the same directory as your wp-config.php file.
- You now have to create a directory on your web server where temporary image files, corresponding to the photos in your queue, will be stored. By default this is the directory “/wp-content/qdir” (called “qdir” directory from here on).
- Make sure that the file permissions of the “qdir” directory are such that the plugin is allowed to write to it (otherwise, uploaded photos cannot be stored).
- Once posted, photos are moved from “qdir” to another directory. PhotoQ organizes posted photos by year and month. Photos posted in January 2007 are consequently moved to an automatically generated directory with name “2007_01″. We’ll call the directory that contains these “YYYY_MM” subdirectories “imgdir”. By default “imgdir” equals “/wp-content”. If you want to use some other directory as “imgdir”, you have to create it now.
- Make sure that the file permissions of the “imgdir” directory are such that the plugin is allowed to write to it (otherwise, the “YYYY_MM” directories cannot be created and posted photos cannot be moved there from “qdir”).
- If your web hosting provider enabled the
mod_securityApache module on your web server, you need to add the following directives to your .htaccess file in order for batch uploads to work:
See the Troubleshooting section for more information.
- You are almost done. Just go to the “Plugins” WordPress admin panel and activate the Photoq plugin.
Using PhotoQ – The Basics
Now that you successfully installed PhotoQ, you are ready to go. First you need to setup some of PhotoQ’s settings:
- In the “Settings” panel of the WordPress Administration you should now have a subpanel labeled “PhotoQ”. Go there.
- The first two fields tell PhotoQ where to look for the “qdir” and “imgdir” directories. If you did not stick to the default options during installation, you need to specify these directories here.
- For now skip the “Meta fields” options
- For every uploaded photo, PhotoQ automatically generates a thumbnail. With the “Thumbnail size” option you specify its size. PhotoQ always keeps the proportions of the generated thumbnail the same as in the original photo. To fit in with a wide range of photoblog templates, PhotoQ gives you three possibilities to define the size of the generated thumbnails:
- “Maximum Dimensions”: you define a rectangle of maximum width and maximum height. Whatever constraint is met first determines the value of the other dimension. You can also use this option to mimic the “Fixed height” or “Fixed width” options of earlier versions of PhotoQ (e.g. to mimic “Fixed height” you can set the “height” to the desired value and the “width” to some huge value such as “99999″. For “Fixed width” you of course do the same but the other way round). The “Largest Side” option of earlier versions can be mimicked by setting “width” = “height” = “Largest Side”.
- “Smallest Side”: you fix the smallest side of the thumbnail to some value and have PhotoQ adapt the other side
- “Fixed Width”: you fix a maximal width. If your thumbnails orientation is “landscape”, it will have this width. If your thumbnails orientation is “portrait”, its height will be adjusted such that it matches the height of a photo with “landscape” orientation. Note that this is not the same as “Fixed width” in earlier versions of PhotoQ (check the comment under “Maximum Dimensions” to see how you can mimic the “Fixed width” option of earlier PhotoQ versions).
- “Image size” specifies the size in which uploaded photos are shown on your photoblog once they are posted and works essentially the same as “Thumbnail size”. If you check the option “Resize only in web browser”, the actual image file stays untouched i.e., it is not resized. The new image widths and heights are only used as “width” and “height” attributes of the HTML <IMG> tag and resizing is thus left to the web browser. If you don’t check “Resize only in web browser”, PhotoQ resizes the photo according to the “Image size” settings. Last but not least, you have the option to keep the original image size by checking the corresponding checkbox.
- If you are all confused now, I suggest that you set “Thumbnail size” to “Fixed height: 80px” and “Image size” to “Keep original image size” for the time being and play with the other options later.
- You might want to check “Deleting Posts: Delete image files from server when deleting post”, otherwise the image files associated with a post are left on the server if you delete the post.
- “Show thumbs in post management admin panel”: Allows you to see a preview of the photo in the list of already posted posts.
- “Enable Batch Uploads”: Allows you to toggle the batch upload capability on and off.
- “Include photo description in post content”: If you check this option, the description of the photo is included in the content part of the post, just after the photo. The description is then placed in a <p> tag with class name “photo_description” to allow for easy styling via CSS. If you do not check this option, the description is placed in a custom field with name “descr”. In short: if you do not know how to or do not want to tweak themes, check this option. If you know how to access a custom field from a theme and want greater flexibility, don’t check this option.
- Skip the cronjob options for now and you are done. Click on “Update options” to save the changes.
Now comes the fun part, you are ready to manage your photo queue:
- In the “Manage” panel of the WordPress Administration you should now have a subpanel labeled “PhotoQ”. Go there.
- As you have not yet uploaded any photos the queue is empty. To upload a photo click the button “Add photo to queue”.
- I think that the upload process is pretty self-explanatory. If you have batch uploads enabled, click on “Select photos…”. You can then choose several photos (via the standard cmd-click on MacOSX and ctrl-click on Windows) in the “Select Files” dialog box that pops up. The selected photos are queued for mass upload. Once the dialog box is closed, uploading starts automatically. You then have the possibility to add more photos to the upload queue, delete individual photos from the upload queue or clear the entire upload queue. Once the upload is completed you can start entering information on the uploaded photos by clicking on the “Enter Info” button that should have appeared.
Choose the categories for this photo, add a title, a short description and some tags if you want. If the title is too long you might want to enter a shorter slug. Sometimes it is nice to see a photo in detail when entering information about it. PhotoQ easily allows this: if you click on a thumbnail, the corresponding photo will open in all its beauty in a new window. Once you entered the desired information, hit “Save Batch Info”. Don’t worry all the information can still be changed at a later stage.
If you have batch uploads disabled, the process is similar only that you choose the file to upload via the “Browse” button.
- If everything went smoothly, you should now see the photos you just uploaded in the queue. You can add other photo to the queue if you like.
- Each entry in the queue can be edited by clicking on “Edit”. This gives you the possibility to alter all the fields.
- As of PhotoQ 1.2, entries in the queue can be easily reordered via drag-and-drop.
- You can remove photos from the queue by clicking on “Delete”.
- To publish the photo at the top of your queue on your photoblog, hit “Post top of queue”. PhotoQ then automatically generates a post where the photo is placed in the content part and the thumbnail is placed in the excerpt. The description is stored in a custom field called “descr”. You have thus access to the photo and the thumbnail in any of your templates via the template tags
the_excerpt, respectively, and you can access the description via the custom field “descr”. Note that you also have the option (if you check the option “Include photo description in post content” on the PhotoQ settings page) to directly include the description in the content part of the post in a <p> tag with CSS class name “photo_description”.
- The entry at the top of your queue should now be removed from the queue and appear as a new post on your photoblog.
- Check the result directly on your photoblog or in the “Manage->Posts” section of the WordPress Administration panel.
If you want to add more information to your photo posts than just the title and description provided by default, you have the possibility to do so via “Meta Fields”. Assume you want to associate each photo with the place where the photo was taken:
- Go to “Options->PhotoQ” in the WordPress Administration Panel.
- Click “Add Meta Field”.
- Give it a name, e.g. “place” and hit “Add Field”.
- For every photo you upload you will now have an additional field called “place” where you can enter the desired information. Once posted, the field is saved as a custom field with the same name.
- The list of Meta Fields can be edited by clicking on “Rename” or “Delete”.
- The three options “Upon Add/Delete/Rename” define whether changes you make to a Meta Field are also applied to the corresponding Custom Field of already posted photos. Example: Assume you already posted 20 photos and only then decide to add a new Meta Field called “place”. If you check “Upon Add, Add to already posted as well”, a Custom Field named “place” (with an empty value) will be added to all of the already posted photos as well.
Automatic Posting Via Cronjobs
PhotoQ allows you to have the top of your queue posted at regular intervals. This is especially useful if you go on a vacation and still want your photoblog to go on. Just fill up the queue before you leave and have PhotoQ do the rest. To set up automatic posting, you need to do the following:
- Set the frequency at which the posts should occur. This can be set in “Options->PhotoQ->Further Options”.
- Remember where on your web server you saved the file “wimpq-cronpost.php”.
- Setup a cronjob to execute “wimpq-cronpost.php” at your desired interval. Don’t worry, most often your webhost will set this up for you if you tell him/her the URL of your “wimpq-cronpost.php” file and when and how often you want the cronjob to be executed.
- Upon each execution of “wimpq-cronpost.php”, PhotoQ checks whether the last post occurred more than X hours ago (where X is the value you set in the PhotoQ Options panel). If so, the top of your queue is posted automatically.
- It might thus be a good idea to set the “PhotoQ Cronjob Frequency” slightly lower than the interval of the actual cronjob. E.g., assume you want a post once a day. Setup your cronjob to execute the “wimpq-cronpost.php” file once a day at the desired time and set the “Cronjob Frequency” in the “PhotoQ Options” to “23h”.
- Note: If your webhost does not allow you to setup your own cronjob you might be able to do something similar with a WordPress plugin such as WP-Cron (I have not tested this, so should you be able to make PhotoQ work together with such a plugin, please drop me a line).
- A neat alternative solution to the above has been brought to my attention by Phil from halfmad.com. If your webhost does not allow cronjobs you can alter the WordPress index.php file in the following way:
<?phpThis then emulates a pseudo-cron executed every time a user visits your website. Thanks Phil, for pointing this out.
/* Short and sweet */
Troubleshooting – Help it doesn’t work!
Here is a short checklist in case something doesn’t work as expected. Please go through this before asking me for help.
- Did you check the requirements?
- Did you check the PhotoQ options? Especially, are the paths to your “qdir” and “imgdir” correct?
- Are you sure “qdir” and “imgdir” file permissions are set correctly?
- Do you have other plugins installed? If so, disable all other plugins and check whether it works now. Should you find any incompatibilities with other plugins please let me know. So far I know about the following plugins that are not compatible with PhotoQ: “Lighter Admin Drop Menus v2.3″.
- Does it work with batch uploads disabled? If not, try to make it work with batch uploads disabled first.
- “I get a HTTP 403 error message when trying to do a batch upload?” Most probably, your web hosting provider enabled mod_security on your web server. Batch upload makes use of Flash and Flash is known to send malformed http headers which are rejected by mod_security. The only solution seems to be to turn off mod_security by adding the directives given above to your .htaccess file. Anyone having a better solutions is most welcome to let me know about it.
- “I am getting a ‘Warning: set_time_limit() has been disabled for security reasons…’ or similar. Some web hosting providers limit the execution time of PHP scripts and do not allow you to change it. PhotoQ tries to remove the limit because if you have a large batch upload, it might take some time. If you get warnings like the one above, you can comment the line
set_time_limit(0);in the beginning of the whoismanu-photoq.php file by replacing it with
//set_time_limit(0);Huge batch upload jobs might then however sometimes be aborted if they take longer than the maximum execution time allowed by your web hosting provider.
If nothing helps, don’t hesitate to ask – I would be glad to help. In order to be able to help you, I need to at least know the versions of WordPress and PhotoQ you are using, your browser/platform combination, whether it works with batch uploads disabled and of course the potential error message you are getting. If you get an error message of any kind, it might also be helpful to know what you were trying to do just before you got the error message. But please check the points above before writing about a problem. At least double-check the requirements. It will save me (and you!) a lot of time that is better spent improving PhotoQ than looking for imaginary problems. Thanks.
Making PhotoQ Better
Any comments, suggestions, bug reports, feature requests, contributions to future versions, compatible themes, etc., etc. are highly appreciated. Any help to improve PhotoQ is more than welcome.
Also, should you decide to make a photoblog using PhotoQ, please let me know. I would be more than happy to let the world know by linking to your site.
Thanks to all the PhotoQ users who help to keep up my motivation to continue this project. Thanks for all the kind comments and helpful bug reports. Special thanks to Manu from burninghat.net for the helpful comments and suggestions and to Monika at webdesign-in.de for pointing out that WordPress 2.5 was imminent and PhotoQ not ready (hey, I made it in advance ;-)). Many thanks to the guys at http://swfupload.mammon.se/. Without their great SWFUpload script, there would be no batch uploads in PhotoQ.