Categories
General

Fixing Photopress for WP 2.0

I’m working on getting Photopress to work well with WordPress 2.0, but it’s not quite there yet. If you’d like to try what I’ve done so far, download photopress-wp2.zip. Note that you’ll need to disable the rich text editor for image inserts to work right.

Update: I’ve replaced the above file with a new version that seems to work better. Image inserts should work under the rich text editor too now.

Categories
General

Photopress 0.8.4

Nothing too exciting in this version, but if you’re using index.php-based permalinks you’ll want it.

New features and fixes:

  • index.php-based permalinks should work now. Thanks to SHRIKEE for spotting and testing this fix.
  • Added a mass resize function. Thanks to Roge for the idea and code.
  • Added an image rotate function.

Download Photopress 0.8.4: photopress.zip OR photopress.tar.gz

What I’m doing next: I think I’ll add category slug and hide image fields to the DB table, plus the bits for working with them. This should lay the groundwork for eventually storing a category’s images in a category-slug-named subfolder of the photos folder. With a lot of images it gets crazy storing them all in the same folder.

Categories
General

Style for images with Photopress

A few of you have noted that the CSS classes available by default for inserted images don’t work very well. centered does center images, but it adds a break so multiple images end up in a vertical column. alignleft and alignright are intended for wrapping text around images, so they’ll break your blog layout if you don’t have enough text in a post. In the next version I’ll probably include an empty class for the default as a sneaky way to avoid complaints. However, you really should use a custom class. Here’s how:

Edit your theme’s style file (style.css), inserting a new class or classes to use for your images. This one adds some padding and a border:

img.pp_style {
padding: 3px;
border: 1px solid #000;
}

Now add pp_style to the list of classes at Options:Photopress. The first one in the list will be the default when you insert images using the Upload/Browse popup tool.

You can do the same thing for random images. By default they use the centered class but at Options:Photopress you can enter any class you’d like.

Categories
General

Fixing author pages in WP

I just noticed that my author pages at wedin.org were pretty messed up and now that I’ve fixed them I figured I’d make some notes about what I did.

The first problem: Giving the admin a nickname that’s the same as an existing username breaks that user’s author page.

I thought it would be nice to give the admin user the nickname ‘isaac’ because then when I commented on posts without remembering to log out the comments would say ‘isaac’ rather than the Orwellian ‘admin.’ Obviously, I wasn’t thinking straight – one should only do serious admin tasks when logged in as the admin. The danger of making a mistake isn’t the only drawback – it somehow confuses WordPress, breaking the author archive page of the user whose nickname the admin uses. This may only happen with permalinks – I didn’t investigate it extensively.

The solution: Set the admin’s nickname back to ‘admin’ (and log out after doing admin stuff!). Or I guess you could promote your normal user high enough to do most admin tasks.

The second problem: Broken author pages for users with ‘@’ and such in their usernames.

Some of my users have registered using their email addresses as usernames. That shouldn’t be a problem – WordPress allows ‘@’ and ‘.’ in usernames, so it should be able to deal with them, right? Apparently not with permalinks turned on. Without permalinks the author page receives an author ID to identify which posts to show. With permalinks the author page receives the author nicename to identify which posts to get. Unfortunately, the WordPress function the codex suggests using to get the author info is get_userdatabylogin(), which wants (duh) the author’s login. The login has things like ‘@’ and ‘.’ but the nicename does not. So, for my users crazy enough to use their email addresses for login names the author page was showing nothing.

The solution: Rewrite the author page to use this query instead of get_userdatabylogin():

$wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_nicename = '$queried_name'");

This should probably be in a cascade of if…else statements so that turning off permalinks doesn’t break the author page.

Categories
General

Photopress 0.8.3

It took forever to wring out the bugs in this version.

New features and fixes:

  • Fixed the problem with uploading in IE, in the process made the MIME/extension checking work better.
  • Better error handling, including a check for the GD module for PHP.
  • Added some support for the rich editor in WordPress 2.0-RC1. If you’re not using the rich editor it works as usual.

Download Photopress 0.8.3: photopress.zip OR photopress.tar.gz

Updates: Fixed the problem that Prashant found with having 2 images next to each other on a line (me and regexps never have gotten along that well). Fixed the problem Miroslav found with the no-album option (it was being ignored entirely). Fixed a problem Kaibo found with using exif_imagetype – now it falls back to the slower getimagesize if you don’t have the exif stuff installed.