Heads or Feet: Custom Image Crop Position with WordPress

The design for a recent WordPress website required great emphasis on images and the respective thumb-nail. The project was for a portrait artist to showcase his works.

Under normal circumstances WordPress crops a thumbnail from the center of an image. This works great in most situations. Portraits however, usually focus the face in the upper third of the image. With the WordPress automatic thumbnail generation, I was getting cropped heads and great looking shirts and ties.

I was surprised to find that setting a custom position for thumbnail cropping had not gained much attention within WordPress. After searching, I found many hacks that required editing the core WordPress files. I did not want to take that approach since updates to WordPress would overwrite the changes. I also wanted the flexibility to set the custom position for the portraits but not all the generated thumbnails (a lot of items already looked good).

I found a blog post with exactly what I needed: Image Crop Position in WordPress by Brad Touesnard. I followed his instructions and created a custom include file. Voilà – the top of the heads are back!

Hopefully custom crop positions will be added to the core functionality in a future release of WordPress. Until then, it is terrific to have a community of developers willing to share.

The left image displays the default WordPress settings for cropping. The right image displays the custom top/center setting.

Images courtesy of portrait artist Michael Shane Neal.