3

For some reason Wordpress is cropping some of my thumbnails proportionately rather than to specific dimensions for some images, and cropping them to specific dimensions for others.

I want it to crop all my thumbnails to 728 x 410 pixels, but some of them are taller than 410 pixels.

Here is what I have in my functions.php:

add_image_size('main-thumbnail', 728, 410, true);

Here is what I have in my content.php:

<div class="thumbnail"><a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('main-thumbnail'); ?></a></div>

This works for some images but not for others, and I don't know what is causing this.

I have also regenerated my thumbnails using the Regenerate Thumbnails plugin but nothing changed.

What is the reason for this?

3
  • 2
    are the originals all wider than 728 and taller than 410?
    – Milo
    Commented Jun 10, 2016 at 3:35
  • No they're not. I think you might be on to something because the ones that aren't cropping to those dimensions are the ones that are smaller than 728 x 410.
    – 5AMWE5T
    Commented Jun 10, 2016 at 3:36
  • 2
    yeah, it won't generate images that are larger than the original.
    – Milo
    Commented Jun 10, 2016 at 3:47

0

Browse other questions tagged or ask your own question.