Sun 30 Mar 2008
This blog primarily serves as a place to post my least worst photographs. Because of this, I like to provide reasonable-sized (400 pixels wide or long, depending on the orientation) thumbnails inlined in the article, each of which each links back to the photograph in its original resolution. Wordpress actually doesn’t allow you configure thumbnail sizes but you can hack a PHP file for a (fixed) custom thumbnail size. Additionally, you can increase the picture size threshold for which pictures will have a thumbnail created.
This involves two simple changes to wp-admin/includes/image.php:
- Locate the wp_create_thumbnail function and edit the value of $max_side. This blog uses a value of 400.
- Search for wp_thumbnail_creation_size_limit; it’s one argument to a function that calculates the maximum picture size that will be considered for creating thumbnails. The default maximum size is 3 * 1024 * 1024, i.e. 3 megapixels. This is quite small, especially for panoramic pictures, and I changed the 3 to 10 without issue on my virtual server with 128MB RAM.
This can go a long way towards making a photo-centric blog, like this one, a lot prettier.
UPDATE: No sooner have I upgraded to Wordpress 2.5 than I discover you can now configure thumbnail size from the GUI; the option is well hidden away in Site Admin -> Settings -> Miscellaneous.