0

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.

2
  • which plugin you've installed ?
    – Amit Kosti
    Aug 1, 2012 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? Aug 1, 2012 at 19:03

2 Answers 2

3

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.

3
  • 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. Sep 11, 2012 at 19:50
  • 1
    Great stuff :) You can read more about WP's crop feature here
    – tone7
    Sep 12, 2012 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 :) Sep 12, 2012 at 15:24
1

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.

7
  • 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 Aug 1, 2012 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! Aug 7, 2012 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) Aug 7, 2012 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! Aug 7, 2012 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. Aug 7, 2012 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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