Modifying WordPress Thumbnails

WordPress is a great blogging application and it’s what this blog runs on. One of the great things about WordPress is the ability to modify the underlying code so that you can customize it your needs. Because I like to put photos on this blog I needed to hack the code a little. The problem is that WordPress defaults to 128 pixel thumbnails which is pretty small. (This example is on WordPress v2.3.1)

128 pixel photo

That’s a 128 pixel photo, pretty small huh? So I modifed the code to create 450 pixel thumbnails.

450 pixel photo
That’s more like it at 450 pixels.Here’s how I did it.

image.php

In your wp-admin folder is an includes folder and inside that is a file called image.php which is the file we will be modifying.128 pixels

This is the old code that has the thumbnail size set to 128 pixels. It’s on line 153 of the file.

450 pixels

Here’s the file after being modified. It will set the thumbnail maximum long side to 450 pixels. You can set it to anything you want but I found 450 pixels is a good size that fits most template designs.Just modify the file and upload it onto your server into the includes folder. Now when you have a nice detailed photo you want to show-off just upload the image via the WordPress Dashboard by hitting the Browse button in the editor and choose

Thumbnails

This will display the 450 pixel thumbnail on the page and link to the bigger original image uploaded when people click on the thumbnail. Like the image below.

800 pixel image

Click here for another web tutorial on the same modification, but also for users of earlier WordPress versions than 2.3

*UPDATE FOR WORDPRESS 2.5*

Now you can set thumbnail size via your admin settings just go to:

Settings>Miscellaneous>Image Sizes>Thumbnail Size

Then enter what size you want your thumbnails to be, I set mine to 450 pixels

Share and Enjoy:
  • Digg
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Technorati
  • De.lirio.us
  • Facebook
  • Fark
  • Google
  • Ma.gnolia
  • Reddit
  • TwitThis
  • YahooMyWeb
  • Propeller

22 Responses to “Modifying WordPress Thumbnails”

  1. J.K. Says:

    Simplicity is best! This worked like a charm. Thanks for providing a line reference for the code.

  2. Amara Says:

    I cannot figure out how to poat a photo. Can you help me get started?

  3. baron Says:

    1. Save your photo as jpeg on your computer.
    2. When wrting a new post/page click on the ‘Browse’ button below the editing window where the tab ‘Upload’ should be highlighted
    3. Locate your file on your computer and choose it
    4. Give it a Title & Description if wanted, click ‘Upload’
    5. Choose ‘Thumbnail’ and ‘File’ button as in the example shown and click ‘Send to editor’

  4. just me Says:

    Many thanks.
    Every time I update I have to go looking for that dreaded ‘wp_thumbnail_max_side_length’ code :P

  5. John Says:

    Thanks for the great tutorial. Follow-up question for you. Is there a way to make it so that it’s always 400 pixels wide? I don’t care about the height, but I would like the width to always be 400. Thanks again.

  6. archshrk Says:

    I found that I needed to change this line…

    function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 )

  7. Doktor Says:

    Works perfectly! :)

  8. Danny Foo Says:

    I don’t want to edit my thumbnail sizes but I’d like to increase the upload limit of my images and the limited size. Currently it’s on..

    3 * 1024 * 1024

    I tried changing it to:

    8 * 2048 * 2040

    However, when I tried uploading an image larger than 1024 the thumbnail option wasn’t available.

    Are you experiencing the same problem?

    p/s: Running WP 2.3.1

    Regards.

  9. Change The Default Thumbnail Size In Wordpress | David Pitlyuk Says:

    [...] allow you guys to click the 500 pixel version to see the larger version by default. Luckily I found Baron’s Blog that shows just how to do this. It’s pretty easy, it just requires modifying one file in [...]

  10. Ernie Says:

    Dumb question: Where do I find the wp-admin folder, exactly?

    Sorry for ignorance, thanks for the help!

    Ernie

  11. baron Says:

    You will find it in the same directory as your blog address. So you’ll see lots of files with wp- at the start of their filenames, with wp-admin being the first of those files.

  12. Ernie Says:

    Thanks so much, Baron—but I don’t see image.php in the Wp-admin folder! Any clue…

  13. baron Says:

    This only works for the latest versions of WordPress. For earlier versions go here:
    http://www.dagondesign.com/articles/change-default-thumbnail-size-in-wordpress/

  14. Ernie Says:

    THANKS!!!!! I’m 2.2

  15. Ernie Says:

    Hmmm—800 different lines in Dreamweaver when I open it up—any idea what line? No problem, if not

    Thanks for your patience

    Ernie

  16. The Secret of the Wednesday’s Haul » Blog Archive » links for 2008-05-01 Says:

    [...] Baron’s Blog » Blog Archive » Modifying WordPress Thumbnails (tags: wordpress thumbnails how-to) [...]

  17. Vote My Thumb Says:

    Thank you very much. Nice post and very informative.

  18. Denise Says:

    Before I try this I want to make sure it is compatible with WP 2.5. Also, do you know whether it will work when adding pics using image manager or other such plug-ins?
    For some reason I’m getting super tiny (like maybe 40px square) for thumbnails and can’t figure pout why. I changed the settings in the Misc section for thumbnail size but it had no effect. I looked at my themes CSS and other files and couldn’t see anything about thumbnails. (Though I’m no expert).
    Any thoughts on all this?

  19. baron Says:

    You don’t need to modify the code anymore, WordPress has a setting for thumbnails. I just updated the info on this post.

  20. Walwala Pictures Says:

    yaa baron is absolutely right….

    You don’t need to modify the code anymore… now wordpress deals with it…

  21. Blog Picture Says:

    In-depth view. Like it very much. I will follow these tips provided herein to examine its specific outcome after putting into use in real cases. Thanks from me.

  22. Piter Says:

    Лаванда, горная лаванда. Наших дней с тобой синие цветы. Лаванда, горная лаванда Все у меня зашибись и я этому просто супер рад. Я все время работаю, поэтому такой худой и зашуганный.

Leave a Reply