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 Thursday, September 27th, 2007 at 9:21pm

Change Default Thumbnail Size in WordPress

One question I get asked quite often is how to change the default size of the thumbnails that WordPress creates when you upload an image. It is actually quite 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 versions 2.0 through 2.3. If you are using WordPress 2.5, there is now a built-in option to change the thumbnail size.

Instructions for:


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

WordPress 2.5 now includes a built-in option to change the size of thumbnails. In your dashboard, just go to ‘Settings -> Miscellaneous’

Pages: « 2 [1] Show All

  1. 15
    Reilly

    great help, thanks

  2. 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.

  3. 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.

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

  5. 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

  6. 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).

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

  8. Many thanks for this great tip!

  9. Thanks, works great :-)

  10. 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.

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

  12. 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.

  13. 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.

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

  15. 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.”

Pages: « 2 [1] Show All

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.