Reputation: 5238
Hey.. quite embarrassed to ask this actually - I should be able to find this on Google, but because of all the new WP functionality as well as the older methods of doing this in older versions are riddled all over Google Results that I have resorted to leverage the knowledge of a good samaritan out there somewhere.
I already know how to set up custom thumbnail sizes (I'm developing a Magazine style theme), and at the moment I'm working on getting my gallery working. When I choose to "insert to post" an image, it gives me 4 options - small, medium and large thumbnails plus the original size.
I need to know, for embedding purposes (not the featured post thumbnails), how to set the default sizes of these thumbnails so that they appear in the Media section of the Post editing screen.
Any ideas?
Upvotes: 12
Views: 39238
Reputation: 220
In function.php add this code:
update_option( 'thumbnail_size_w', 250 );
update_option( 'thumbnail_size_h', 141 );
update_option( 'medium_size_w', 850 );
update_option( 'medium_size_h', 478 );
update_option( 'large_size_w', 1200 );
update_option( 'large_size_h', 675 );
Image Size Names : ‘thumb’, ‘thumbnail’, ‘medium’, ‘large’
The names “thumb” and “thumbnail” are just aliases
Upvotes: 10
Reputation: 5238
I answered my own question folks, and I feel quite dumb.. haha.
It was in the Admin screen. Left bar.. Settings -> Media, and there they are. Thumbnail, medium, and large sizes. No file hacks, no custom size settings in the functions.php file necessary.
Oops!
Upvotes: 18
Reputation: 11029
Look in your wordpress root folder as such:
wordpress_root\wp-includes
In this folder there is a file called: media.php
Starting on Line 34 there is a function:
function image_constrain_size_for_editor($width, $height, $size = 'medium')
in this function, starting on Line 41, there is the following code. Just edit this for your needs:
elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
$max_width = intval(get_option('thumbnail_size_w'));
$max_height = intval(get_option('thumbnail_size_h'));
// last chance thumbnail size defaults
if ( !$max_width && !$max_height ) {
$max_width = 128;
$max_height = 96;
}
}
Upvotes: -11