Support » Plugin: WP SmartCrop » Changing the aspect ratio?

  • Resolved portalp

    (@portalp)


    I love this plugin and it is cropping the images perfectly.. However.. If i wanted to change the crop size where would i do that? I can set the focal point fine and that all works and makes sense. However what chooses the actual aspect ratio for the crop? Can that be edited?

    Thanks! Gave u 5 stars. 🙂

Viewing 1 replies (of 1 total)
  • Plugin Contributor gschoppe

    (@gschoppe)

    Hi Portalp,

    The goal of smartcrop is to let you style smartcropped images however you like, to change their aspect ratio. As such, it does require a making some changes to your site’s CSS styles to change an image’s aspect ratio.

    for example, if you wanted to make every smartcropped image on the site 200px tall and 100% wide, you could add a css rule either to style.css or in the customizer that looked like this:

    img.wpsmartcrop-image {
    	display: block;
    	width: 100%;
    	height: 250px;
    }

    if you wanted that rule to only apply to the homepage, it would look like this:

    body.home img.wpsmartcrop-image {
    	display: block;
    	width: 100%;
    	height: 250px;
    }

    if you only wanted it to apply to featured images, the exact markup would depend on how your theme is structured, but it might look something like this:

    #content header img.wpsmartcrop-image {
    	display: block;
    	width: 100%;
    	height: 250px;
    }

    The big feature smartcrop adds is being able to apply css styles to any image, just like you would to a div or any other tag, without worrying about setting specific aspect ratios or sizes. No matter what ratio the image ends up being on page, it will still work, even if you resize the window and the image’s aspect ratio changes as a result.

Viewing 1 replies (of 1 total)
  • The topic ‘Changing the aspect ratio?’ is closed to new replies.