Support » Plugin: WP SmartCrop » Possible to set specific aspect ratio

  • Resolved awpu



    I want all my featured images to have an aspect ratio of 2:1, regardless of original image size.

    So basically, I click on the focal point and get back the largest 2:1 image possible.

    Can this be done with smart crop?


Viewing 9 replies - 1 through 9 (of 9 total)
  • Absolutely! The goal with SmartCrop is to let you control aspect ratio however you want, using CSS.

    to force an aspect ratio of 2:1 on a smartcropped image, you add a wrapping div with a class like “featured-image-wrapper”, and then add css like this:

    .featured-image-wrapper {
        position: relative;
        padding-bottom: 50%;
    .featured-image-wrapper > img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;

    There is also the legacy option of using add_image_size() to register a new image size that is 2:1 (or several). Smartcrop will make sure the new image sizes are properly cropped.

    Thank you, though not getting anticipated results. I now have a lot of blank space under my featured images. It’s a grid layout, with feature image above, and title below the image.

    I was hoping to simply end up with the largest 2:1 image possible, already autosmart-cropped, therefore making the blank space unnecessary.

    Should I be adding another css rule with .wpsmartcrop-image?


    P.S. I am using Jetpack Photon, so I had to turn off the generate thumbnail option.

    • This reply was modified 7 months, 2 weeks ago by  awpu.
    Moderator Jan Dembowski


    Forum Moderator and Brute Squad

    @gschoppe This is a very important question: what is your relationship with @burlingtonbytes plugin?

    Hi Jan, sorry for the confusion. I’m the lead developer at Burlington Bytes (now called You can find my bio here:

    @jdembowski Thank you. I should be more careful.

    @gschoppe Can you confirm if you go my email(s)?


    Hi @awpu, I got your email and am investigating. It haven’t reviewed Photon for the last year, and it looks like the service has changed a fair amount in that time. It looks like photon is replacing the entire image tag, and not respecting the normal classes and filters that wp_get_attachment_image outputs. I’m hoping I can find a similar filter to the one that SmartCrop uses on normal featured images, that can be used to enable the functionality with this new version of photon, but I am not sure yet if I’ll be successful.

    I’ll keep you updated with what I find.

    Thank you. Also FYI, I see this php warning:

    Illegal offset type in isset or empty.
    wp-content/plugins/wp-smart crop/wp-smartcrop.php:460

    Moderator Jan Dembowski


    Forum Moderator and Brute Squad

    @gschoppe Please contact the plugins team about how to get your account here added as a plugin support role for this plugin.

    Plugin Author


    Hi Awpu,

    We’ve spent the last month digging into every possible aspect of this issue, and unfortunately it looks like Photon is a sticking point. Since the last time we reviewed the Photon service, they’ve changed their implementation completely, and they no longer output the attachment ID or image size in the IMG tag. SmartCrop relies on these classes to be able to properly identify the image and whether or not it has already been cropped, so without these classes, it is unable to run.

    I’m sorry for the inconvenience.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Possible to set specific aspect ratio’ is closed to new replies.