Adding Custom Image Sizes

// Add new image sizes
function lc_insert_custom_image_sizes( $image_sizes ) {
// get the custom image sizes
global $_wp_additional_image_sizes;
// if there are none, just return the built-in sizes
if ( empty( $_wp_additional_image_sizes ) )
return $image_sizes;
// add all the custom sizes to the built-in sizes
foreach ( $_wp_additional_image_sizes as $id => $data ) {
// take the size ID (e.g., ‘my-name’), replace hyphens with spaces,
// and capitalise the first letter of each word
if ( !isset($image_sizes[$id]) )
$image_sizes[$id] = ucfirst( str_replace( ‘-‘, ‘ ‘, $id ) );
}
return $image_sizes;
}
function lc_custom_image_setup () {
add_theme_support( ‘post-thumbnails’ );
add_image_size(‘Mini Square’, 70, 70, TRUE);
add_image_size(‘Square’, 100, 100, TRUE);
add_image_size(‘Featured Tabs’, 150, 225, TRUE);
add_image_size(‘Featured’, 640, 220, TRUE);
add_filter( ‘image_size_names_choose’, ‘lc_insert_custom_image_sizes’ );
}
add_action( ‘after_setup_theme’, ‘lc_custom_image_setup’ );
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s