Custom Image Sizes
Resizing without cropping is already part of the core functionality, via
Note the last parameter:
<?php add_image_size( $name, $width, $height, $crop ); ?>
The Codex entry describes the
$crop parameter as follows:
(boolean) (optional) Crop the image or not. False - Soft proportional crop mode ; True - Hard crop mode.
I prefer to describe the option as hard-crop vs. box-resize. Hard-crop will crop the image based on the most-restrained dimension, whereas box-resize will simply resize the image, retaining its original dimension proportions.
So, to create a box-resized image size, simply define it as follows:
add_image_size( 'image-size-name', $width, $height, false );
Note that this behavior is the default setting. In order to hard-crop, you have to explicitly specify
$crop to be
post-thumbnail image size to box-resize is similar; simply use
set_post_thumbnail_size(), which also has a
<?php set_post_thumbnail_size( $width, $height, $crop ); ?>
Reserved Image Sizes
I'm pretty sure
'large' image sizes are already box-resized rather than hard-cropped.