Get thumbnail URL :)

I try to get thumbnail URL correctly…

In my functions.php, I have theses lines:

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 'emphasis', 132, 82, true );
function w_thumbnail_src() {
    if (has_post_thumbnail()) {
        $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'emphasis');
       echo $thumb[0]; // thumbnail url

The thing is, I don’t get the correct size in my template 🙁
I have this:

<?php w_thumbnail_src(); ?>

That returns the big image, not the thumbnail 🙁

Where am I wrong?


Solutions Collecting From Web of "Get thumbnail URL :)"

You are not using set_post_thumbnail_size properly.
Try with:

add_image_size( 'emphasis', 132, 82, true );

You are using the wrong function to set the size of the image. You want to use add_image_size('emphasis', 132, 82, true ); set_post_thumbnail_size() sets the default post thumbnail size and does not accept a name attribute.