How to automatically add rounded corners to thumbnails?

I want to created automatically rounded corner thumbnails for a particular project I’m working on, using something like this: http://webdeveloperplus.com/php/create-thumbnail-images-with-rounded-corners/

What I’d ideally like to do is find a way to hook something like this into the thumbnail creation process itself and cache it serverside. /wp-includes/media.php doesn’t seem to have any applicable hooks, so I might have to roll my own.

Any clues on where to start?

EDIT:
Not in CSS. There have been some good suggestions about this but I’m using border-radius all over the site, and the images specifically need to be rounded on the server side. Thanks

9 s
9

Looks like you can hook into the wp_create_thumbnail filter:

function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
if ( !empty( $deprecated ) )
     _deprecated_argument( __FUNCTION__, '1.2' );
     $thumbpath = image_resize( $file, $max_side, $max_side );
     return apply_filters( 'wp_create_thumbnail', $thumbpath );
}

So just do your manipulation, and return the result to wp_create_thumbnail.

Leave a Comment