Support » Theme: Sorbet » Featured Images not Cropping

  • When I add a featured image and choose to crop it, it saves a new cropped version, but the original image is always displayed as the featured image on the first page. How do I change the crop settings? I looked through functions.php but couldn’t find anything.

    I am using a child theme.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    Could you provide a link to your site running Sorbet so I can take a look?

    Does the problem persist if you revert back to the parent theme?

    My site is http://www.anthonyteacher.com. I haven’t tried reverting back as of yet.
    To work around this issue, I have been uploading pre-cropped images.

    Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    I just tested this and do not get an option to crop featured images on posts in Sorbet, running version 1.2.2 with WordPress 4.6.1.

    Sorbet allows featured images to be up to 999px high, as seen in this function:

    add_theme_support( 'post-thumbnails' );
    add_image_size( 'index-thumb', 770, 999 );

    You can read more about the add_image_size function here:

    https://developer.wordpress.org/reference/functions/add_image_size/

    As you can see, unless you specify otherwise — by adding a true parameter to the function — featured images are not cropped.

    I’m not sure why you’re getting an option to crop the featured image when you add it — that shouldn’t be possible. Are you adding it directly within each post?

    You can modify the function to add a hard crop if you prefer that over cropping the image outside of WordPress, but all the images will be cropped to the same height. If you’re interested in adding that to your child theme, let me know.

    When you select an image for “Featured Image,” there is an option to edit the image, and then an option to crop it. That’s what I was trying to use. I would take a very large image, and choose a cropped size for the site. However, it never worked.

    As for

    add_theme_support( 'post-thumbnails' );
    add_image_size( 'index-thumb', 770, 999 )

    If I change the 999 to a different size, will it just shrink the image, or actually crop it to that size?

    Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    Try this function in your child theme to crop newly uploaded featured images to 183px high — I took that height from your current site, but you can modify it to anything you like. The true setting allows the cropping to take place.

    function sorbet_child_formats() {
      add_theme_support( 'post-thumbnails' );
      add_image_size( 'index-thumb', 770, 183, true);
    }
    add_action( 'after_setup_theme', 'sorbet_child_formats', 11 );

    It should work on featured images uploaded after you add the function to your child theme.

    Let me know how it goes.

    Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    Hi there – just wondering, did this function work out for you?

    I have not tried it yet, but I will before my next post.
    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Featured Images not Cropping’ is closed to new replies.