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('wp_thumbnail_max_side_length',
128, $attachment_id, $file);

and change it to:

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

That will double the thumbnail size like mine ;)

Well done and have a great day!

Share and Enjoy:

  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • BlinkList
  • BlogMemes
  • co.mments
  • description
  • Furl
  • Ma.gnolia
  • NewsVine
  • RawSugar
  • Shadows
  • Simpy
  • Slashdot
  • Spurl
  • Technorati
  • YahooMyWeb
  • Google
 

Related Posts


18 Responses to “Change Default Thumbnail Size in WordPress 2.3”  

  1. a gravatar 1 Craig

    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

  2. a gravatar 2 Craig

    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( ‘wp_thumbnail_max_side_length’, 150, $attachment_id, $file );
    } else {
    $max_side = apply_filters( ‘wp_thumbnail_max_side_length’, 200, $attachment_id, $file );
    }

  3. a gravatar 3 dust

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

  4. a gravatar 4 tony

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

  5. a gravatar 5 Mike

    Hello,

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

  6. a gravatar 6 Shabu Anower

    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 :)

  7. a gravatar 7 supriyadisw

    Mike: Thanks for your help :D

    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.

    Thanks

  8. a gravatar 8 Shabu Anower

    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 :D

    Thanks for your time :)

  9. a gravatar 9 supriyadisw

    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.

    Example:
    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'); ?>/
    wp-content/images/<?php
    echo $post->ID; ?>.thumbnail.gif" alt="" />
    

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

    <img src="<?php
    echo get_settings('home'); ?>/
    wp-content/images/<?php
    echo $post->ID; ?>.gif" alt="" />
    

    Gud lak! Thanks

  10. a gravatar 10 Shabu Anower

    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 :)

  11. a gravatar 11 Shabu Anower

    Well, problem solved :D

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

  12. a gravatar 12 supriyadisw

    Shabu: Finally, you use extra fields LOL

    Have a great day!

  13. a gravatar 13 Mateusz

    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 php.net 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.

  14. a gravatar 14 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

    Thanks

  15. a gravatar 15 Mark

    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!

  16. a gravatar 16 Tinh

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

  1. 1 CSS Gallery theme | OS Designer
  2. 2 How to Change Wordpress Default Thumbnail Size | HemiNeko.net Blog
Posting Your Comment
Please Wait

Yes, leave a comment here!

There was an error with your comment, please try again.