Change Default Thumbnail Size in WordPress 2.3

Here is a simple guide how to change the default size of the thumbnails that WordPress 2.3 creates when you upload an image.

It is actually quite easy to change – it just requires modification of one WordPress file.

From time to time I wonder just how big the image thumbnails are, and occasionally I even ponder how to go about changing that thumbnail size.

The size for the thumbnail creation in WordPress 2.3 could be changed in the /wp-admin/includes/image.php file.

Just open the file and search for:

$max_side = apply_filters('ws6q9jzl7p_thumbnail_max_side_length',
128, $attachment_id, $file);

and change it to:

$max_side = apply_filters('ws6q9jzl7p_thumbnail_max_side_length',
256, $attachment_id, $file);

That will double the thumbnail size like mine 😉

Well done and have a great day!

  • Ah, but the question is — how do I adjust only the X axis — I want all photos to be 150px max, regardless of the horizontal or vertical aspect ratio

  • Actually — I’ve figured this one out. The final mark up, simply replace the line above with this fellow:

    if ( $metadata['width'] >= $metadata['height'] ) {
    $max_side = apply_filters( 'ws6q9jzl7p_thumbnail_max_side_length', 150, $attachment_id, $file );
    } else {
    $max_side = apply_filters( 'ws6q9jzl7p_thumbnail_max_side_length', 200, $attachment_id, $file );

  • Thanks OP (and Craig) for the info. I used it with 2.3.2 and still works.

  • can you set this code to edit both the height AND width? Anybody?!

  • Hello,

    Can anyone tell me where to find the thumbnail file in version 2.3.2 as I cannot find it as stated above.

  • Thanks for the hack 🙂

    Could you please tell me, how can I show the thumbnail at homepage? and bigger image on single page?

    Is there any templates Tag for this?

    Thanks 🙂

  • Mike: Thanks for your help 😀

    Shabu Anower: Do you mean what you see on my blog? I use a custom field to make it. Hopefully I can share how to make it.


  • No, I don’t want to use extra field. After uploading an image, I get two image. One bigger one and second one is thumbnail.

    I want to add the bigger (main image) image on content editor and want to show the thumbnail on homepage post by placing any PHP tag in index.php. Main

    Actually, I want to make a CSS showcase 😀

    Thanks for your time 🙂

  • Hi Shabu,

    Got it. Hmm… By default you will get extra thumbnail file. Eg. You upload image.jpg, you will get image.jpg and image.thumbnail.jpg

    Actually, It’s up to you. You can create your own rule when you upload the image. You can use “ID” as a name for your image.

    Your new post has ID=3 then you create an image with name 3.jpg . You should get 3.jpg and 3.thumbnail.jpg when you upload your image, right?

    In index.php or home.php you can show the image with:

    <img src=”<?php
    echo get_settings(‘home’); ?>/
    echo $post->ID; ?>.thumbnail.gif” alt=”” />

    But in your single.php you should show your image by:

    <img src=”<?php
    echo get_settings(‘home’); ?>/
    echo $post->ID; ?>.gif” alt=”” />

    Gud lak! Thanks

  • Okay, I understand this. but the problem is default uploaded folder is not the “images” folder.

    It’s changing by month 🙁

    Thanks for your help 🙂

  • Well, problem solved 😀

    Now I am using 3 extra fields for Image, thumbs and URL 😉

  • Shabu: Finally, you use extra fields LOL

    Have a great day!

  • Pingback: CSS Gallery theme | OS Designer()

  • Since you’re on the subject, how would you go about not only resizing the uploaded image, but also cropping it to scale?

    Let’s say I’ve got an 640×480 image, and want to change the thumbnail to 600×200 (3:1) but retain the proportions of the main image.

    I’ve been looking over and trying to read up on wordpress hooks, but I’m not even certain where to begin.

    If you could give me a pointer as to which php or wp function I should be staring at, I’d appreciate it.

  • Pingback: How to Change Wordpress Default Thumbnail Size | Blog()

  • Uri

    If you are up to it, can you now post now on how to change the default sizes for thumbnail, medium, and “full” size in WP 2.5


  • Uri, in WordPress 2.5, you no longer have to edit the files by hand to change the default thumbnail size. Instead, you just go to Settings -> Miscellaneous, in the admin panel, and scroll down to Image Sizes. Very easy!

  • great tips, let me give it a try and see how it works then

  • Dan


    Actually, the setting is under the Settings -> Media menu in the Dashboard.