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.

It seemed a huge oversight that the Wordpress editor couldn’t create thumbnailed links to pictures.

A few moments of googling indicated that the GD module was needed; it allows PHP scripts manipulate images.

Now, I can do this:

IMG_2198.JPG

Actually, you need to do a little more if you, like me, you prefer large thumbnails – pretty posts with the full-size image available if you wish.

To do so, edit wp-admin/inline-uploading.php and search for “imagedata“. Around those lines, the 128 is the width of thumbnails and 96 is their height; I change this to 400 and 300, respectively.