• Hi, I use ACF, and I have problem with thumbnails(custom field return object image). In functions.php I add new thubm size:

    add_image_size( 'single-thumb', 1200, 300, array( 'center', 'top' ) );

    and in themplate

    <?php
    $image = get_field('thumb', $caught->ID);
    $newthumb = $image['sizes']['single-thumb'];
    ?>
    <img src="<?php echo $newthumb; ?>" alt="<?php echo $image['alt']; ?>">

    $newthumb returns the url to original image, not thumbnail ?? but, when I set single-thumb to:

    add_image_size( 'single-thumb', 1200, 300 );

    and it generate proper thumbnail, conclusion?? Cropping thumbnails not working, why?

Viewing 1 replies (of 1 total)
  • What are the dimensions of the original image you’re uploading? A thumbnail won’t crop a 1000×1000 image to 1200×300, since it’s not wide enough, which means that image will not have a single-thumb version.

    If cropping isn’t enabled for that size, then it will resize it to fit. So for the 1000×1000 example, it will resize to 300×300 to fit within 1200×300.

    An image can’t be cropped if either of its dimensions is shorter than one of the dimensions defined in add_image_size, basically because the image size cannot blow-up an image file.

    • This reply was modified 7 years, 6 months ago by Jacob Peattie.
Viewing 1 replies (of 1 total)
  • The topic ‘Thumbnail croping not working’ is closed to new replies.