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.

Im using a theme which has my thumbnais set to 150x150px. But after installing plugin (just too check it out) I noticed it displays them correctly, but the default thumbnails are zoomed in. Can anybody give me a clue on where I should be looking? This is the css for the thumbs:

#content .featured_box { width: 150px; float: left; margin-right: 14px; color:#afafaf; }
#content .featured_box img { width: 150px; height: 150px; }
#content .featured_box p { font-size: 11px; color:#afafaf; }
#content .last { margin-right: 1px; }
#content .first { margin-left: 1px; }

.recent_box { width: 150px; float: left; margin-bottom: 15px; }
.recent_box img { width: 150px; height: 150px; }
.recent_box h3 a { font-size: 13px; color: #000; text-decoration: none; }
.recent_right { float: right !important; }

Edit: Im still no further forward with this, can anybody else think of anything else why/how this would be happening? Could it be down to the video thumbnail is 16:9 and the thumbail is 4:3?

Here is the php stuff also:

<a href="<?php the_permalink(); ?>"class="img_hover_trans"><?php the_post_thumbnail('featured-small'); ?></a> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

edit 2: I found this in my functions.php

if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
  add_theme_support( 'post-thumbnails' );
  add_image_size('featured-big',335,338,true);
  add_image_size('featured-medium',284,176,true);
  add_image_size('featured-small',150,150,true);
  add_image_size('featured-sidebar',58,58,true);
  add_image_size('featured-blog',336,157,true);
  add_image_size('recent-sidebar',150,150,true);
}

edit 3: Strange on this, but if I change one of the above lines to:

  add_image_size('featured-small',200,150,true);

It displays in the correct aspect ratio (even though its set to 150x150 everywhere else). I dont know why that works, but it does.

share|improve this question
    
which plugin you've installed ? –  amit Aug 1 '12 at 12:01
    
Hi amit :) I installed automatic youtube video post, its thumbs are not squashed. I checked the originals and they are much larger, I just dont know where to start looking for this. Is it css problem or perhaps can I force it to display full image in php? –  Frank Morrison Aug 1 '12 at 19:03

2 Answers 2

up vote 3 down vote accepted

Isn't it because you're using $crop as true, as the 4th parameter for the add_image_size() function?

This will crop the image and does not actually resize the image.

share|improve this answer
    
Yes, that worked! I removed true, set the image back to 150x150 and it kept the correct aspect ratio. Thanks for that tone, I would never have gotten that. I had a flick through my site and it doesnt seem to screw with anything, so Im guessing its not needed. –  Frank Morrison Sep 11 '12 at 19:50
1  
Great stuff :) You can read more about WP's crop feature here –  tone7 Sep 12 '12 at 13:34
    
I will check this out tonight when I get home, but I see somebody mention that they set true to false...that might be better than just removing it all together? Thanks for the help and the info. Mucho appreciated :) –  Frank Morrison Sep 12 '12 at 15:24

I'm pretty sure it's because CSS is forcing a dimension on all images, and the ones that appear "zoomed" are physically smaller, so they get stretched to fit.

Just because your thumbnails are set at 150x150, doesn't guarantee they will be. Images uploaded in the past will remain as they were, even when you change your media settings.

And it's worth notigin WP won't upscale images to fit dimensions, it'll only crop/downscale. So if you upload one that's small to start with, the thumbnail may indeed be less than 150x150.

share|improve this answer
    
Hi man, thanks for replying. I use a plugin called video thumbnail, which will search the posts for youtube links and download the thumb, set it as the featued image then upload the pic to the media libary. I checked the image, and its 480x360px. I was hoping I could show all the image within the 150x150px thumbnail area. Any other ideas? This is for all pics btw, its so strange (looks really unprofessional too). Thanks –  Frank Morrison Aug 1 '12 at 15:50
    
Still totally stuck here guys, I update the original post with some more details...any other advice would be awesome. Thanks again! –  Frank Morrison Aug 7 '12 at 12:46
    
Where is the plugin grabbing the thumbnails from? YouTube? Can you see either in the settings/plugin code where you can change this? Take a look at grabbing YT thumbnails (you can get the smaller version of 120x90) –  TheDeadMedic Aug 7 '12 at 14:00
    
Yeah, the plugin grabs the thumbs from youtube itself. I will check the plugin code tonight and see if I can change which one it picks. Thanks for the suggestion thedeadmedic! –  Frank Morrison Aug 7 '12 at 15:00
    
It seems to download them all, I found various images (with similar labels) in various sizes. I disabled the plugin and manually add a featued image...same problem. Im sure its the theme now, but not sure how to prove it. –  Frank Morrison Aug 7 '12 at 18:29

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.