Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to scale up post thumbnails on Wordpress?

On a featured div I want a post thumbnail/featured image with 584×348 px. When I upload a smaller image as a featured image on a post, it won’t scale up to this size. If the image is 250×250, it will appear 250×250. But if I use a larger image as featured image on the post, it will resize normally.

The thumbnail in functions.php is set this way:

// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size(150, 150); //size of thumbs
add_image_size( 'post-thumb', 600, 380, true ); 

The div:

<div class="featured_thumb"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'post-thumb' ); } ?></div>

And the class:

.featured_thumb {background:#0C6; width:584px; height:350px; overflow:hidden;}

Can someone help me to figure out how to do it please? I thought of using timthumb but I’ve seen lots of complains about security. Not quite sure about it… Anyway, hoping someone could help me.

share|improve this question
    
WordPress's image handling has checks built in that specifically prevent it from scaling images upwards like this, because they look terrible. There is no way to do this without custom code around large parts of the image system. –  Otto Mar 24 '13 at 12:44
add comment

2 Answers

up vote 2 down vote accepted

As WordPress thumbnail generator doesn't do this "scale up" thing, you can do it using the following CSS rule:

.featured_thumb img{ width:100%; height: 100%; }

Hope it will help.

share|improve this answer
    
This actually worked. Thank you. Something so simple I hadn't tried. –  Otavio Vidal Mar 23 '13 at 18:52
1  
Please dont forget to select an answer as the selected answer when it solves your problem in StackExchange. That way it encourage the person who takes time to answer your question. Thanks and glad that it helped. –  Hasin Hayder Mar 23 '13 at 18:56
add comment

If You upload small dimension image and want that image in greater dimensions then image will be Blur.

So upload max dimesion image and scale it upto small dimension so image will not be blur.

share|improve this answer
    
I thought that, but the thing is that the people who would be posting are not into these stuff. This would be an easy way for them, even if it means the image would blur. Thank you, anyway. –  Otavio Vidal Mar 23 '13 at 18:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.