Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Updated Sunday, February 22nd, 2009 at 8:20pm

Change Default Thumbnail Size in WordPress

WordPress 2.5 and later include a built-in option to change the size of thumbnails, but for those of you out there using an older version, it is quiet easy to change. It just requires modification of one WordPress file. When WordPress 2.1 was released, it changed the way this was done, and once again with the release of WordPress 2.3, so I have included instructions below for multiple versions.

Instructions for:

  If you have found this page useful, please consider donating. Thanks!


WordPress 2.0

Open /wp-admin/inline-uploading.php and look for the following code:

if ( $imagedata['width'] > 128 && 
$imagedata['width'] >= $imagedata['height'] * 4 / 3 )
      $thumb = wp_create_thumbnail($file, 128);
    elseif ( $imagedata['height'] > 96 )
      $thumb = wp_create_thumbnail($file, 96);

The default max size is 128 x 96. You can change these numbers to whatever you like, although you must keep the proper aspect ratio (4 / 3).

For example, to double the size of the thumbnails, replace 128 with 256, and 96 with 192. Be sure to change both sets of numbers – they are each listed in the code twice.


WordPress 2.1 – 2.2

Open /wp-admin/admin-functions.php and look for the following code:

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

The number specified here (128 by default) is the maximum size of either dimension. Just change this to whatever you like.


WordPress 2.3

Open /wp-admin/includes/image.php and look for the following code:

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

The number specified here (128 by default) is the maximum size of either dimension. Just change this to whatever you like.

WordPress 2.5 and later

Version 2.5 and later have built-in support for the thumbnail size in the options.

  If you have found this page useful, please consider donating. Thanks!

  1. Running into the same issues with uploading images and sizes on the wp media library. The sizes do match what I put in the media settings. Then when I go to a post to insert a image all the sizes are screwed and under sizes it only shows 3 of 4 available sizes. Thumbnail Medium and Full Size no large?

    I am running:
    WordPress 2.8.5.
    Server: Apache/1.3.37 (Unix)
    PHP: v5.2.3
    GD: bundled (2.0.34 compatible)

    I went through high and low and still having issues.
    I deactivated all plugins. Reactivated 1 by 1. – No luck

    WordPress 2.8.5. – GD Library / WP Media Library Size Issues & Other Issues

    Running into the same issues with uploading images and sizes on the wp media library. The sizes do match what I put in the media settings. Then when I go to a post to insert a image all the sizes are screwed and under sizes it only shows 3 of 4 available sizes. Thumbnail Medium and Full Size no large?

    I am running:
    WordPress 2.8.5.
    Server: Apache/1.3.37 (Unix)
    PHP: v5.2.3
    GD: bundled (2.0.34 compatible)

    I went through high and low and still having issues.
    I deactivated all plugins. Reactivated 1 by 1. – No luck
    I am not running podpress

    Please help this is extremely frustrating…

    Support Topics:
    http://wordpress.org/support/topic/241804?replies=4#post-1274481

    http://wordpress.org/support/topic/227408?replies=25#post-1273733

    http://wordpress.org/support/topic/227408?replies=24

    http://wordpress.org/support/topic/226550?replies=7#post-992291

    http://wordpress.org/support/topic/226550?replies=17#post-1273739

    http://core.trac.wordpress.org/ticket/7151

  2. Thanks so much!!! I really appreaciate your help…THanks again!

  3. does anyone know how to change the article style on the premium news theme from woo themes for small boxes to that of slamxhype.com with the picture on the left and the description on the right?? if you do please email me your answer or code at ventagemusicgroup.com

  4. This page has been updated for WordPress 2.7 – It still has the thumbnail size option built-in, but its position has moved to Settings -> Media

  5. I tried to do it myself, but i failed and you’ve helped me a lot. Thanks!

  6. I got the permanent media php file to work, but if i ever upgrade, I lose all of those settings. I cannot get it to work for my wedding photography blog as a theme. Any suggestions?

  7. Thank you, thank you, thank you!
    Finding that line and changing it, unguided, would have been well beyond my comfort level!

  8. Dagon – you is always da’ man! Never fails, I search on how to do some random thing in wordpress and Dagon comes through like a champ!

  9. Yanurmal: Thanks for the info :)

  10. To resize the thumbnail in WP2.5, open your Dasboard and goto Setting – Miscellaneous. You can resize small thumbnail and midle here :)

  11. 18
    BDcomics

    Thank you! Was very helpful. :)

  12. Hopefully you will update this post to include changing the default thumbnail, medium, and “full” size image uploads for WP 2.5?! This would be greatly welcomed.

  13. Excellent, thanks! I figured it would be in there somewhere but you saved me having to dig through all the code to find out where exactly.

  14. 15
    Reilly

    great help, thanks

  15. Please forgive my stupidness, but where exactly do you find this wp-admin folder?? Is it on my server?

    WordPress 2.3

    Open /wp-admin/includes/image.php and look for the following code:

    $max_side = apply_filters( ‘wp_thumbnail_max_side_length’,
    128, $attachment_id, $file );

    The number specified here (128 by default) is the maximum size of either dimension. Just change this to whatever you like.

  16. 13
    brandon

    Thanks. This was easy. I agree that it would be nice to implement a faster change in the options somewhere. I could see myself forgetting to change this the next time I upgrade, which I’m sure won’t be too far off.

  17. In WP 2.3, can you modify the code in order to set both the height AND width?

  18. hi sir i want a script of submit from where users submit a theams mobile text sms in to my email plz tell me the script

  19. 10
    Steve

    It might be better were you to use a plugin for this, rather than mucking about within the code. There is actually a plugin already written, available at http://www.shiftthis.net/wordpress-thumbnail-size-plugin/ . This is not mine, just something I found. I’ve used it from v2.0 on (including 2.3.1).

  20. thanks so much… it was big problem for me..

  21. Many thanks for this great tip!

  22. Thanks, works great :-)

  23. Excellent, thanks! I figured it would be in there somewhere but you saved me having to dig through all the code to find out where exactly.

    I wouldn’t mind if they take it a step further and allow you to set the thumbnail size on a per-image basis so I can generate different sized thumbnails for different categories, etc.

  24. This is AWESOME! Thanks a lot for this, as it’s going to help in my redesign. :D

  25. Hi

    I found this tip very useful. I’m using at all my blogs.
    This must be a feature that they will implement in future a release.

  26. They should add this to the normal options settings accessible through the dashboard. It is very annoying to need to manually edit this file after each update.

  27. Richard: Both of those things are already possible from the file upload box. You choose ‘Show: Full Size’ and ‘Link To: None’

    Unless perhaps you are using a much older version of WordPress.

  28. I have a related question. Would anyone know how you can hack the image upload code so that instead of having “thumbnail” as the default image size, you can have “full size” be the default? It bugs me that they didn’t allow users to custommize this feature. I’d also like to set the link default setting to “none.”

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.