Support » Plugin: Genesis Featured Page Advanced » how to get image to fill top of widget

  • Resolved Sandra

    (@sandracwalsh)


    Hello –

    The featured images on the pages that I am linking to via the plugin are all different sizes.

    How do I get the image to FILL the space image placeholder while keeping the aspect ratio?

    Similar to:
    background-size: cover;
    background-position: center center;

    Widget settings that I am using:
    Featured Image Size > Medium (300 x 300)
    Image Alignment: Center

    Thank you,
    Sandra

    • This topic was modified 3 years ago by Sandra.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nick Diego

    (@ndiego)

    Hi Sandra,

    Unfortunately, you have to fix this at the source. In other words, you need to adjust the images as opposed to adding CSS.

    It looks like you are using the builtin WordPress medium size of 300×300. This takes whatever size the raw image is and first makes the width 300px. Then if the height is greater than 300px it crops it down. However, if the height, after first reducing the width, is less than 300px, it just leaves the image as is. This is what is causing all of the different heights.

    One solution is to always upload images that are the same aspect ratio. Another is to add your own custom image size to your site. You would add the following code to your functions.php file:

    add_image_size( 'my-custom-size', 300, 200 );

    More information on adding a custom image size can be found here. One thing to note about adding an image size though, is that any images that are already on your site will not work correctly with the new image size. WordPress crops an image to all specified image sizes at the time the image is uploaded. There is a very useful plugin called Regenerate Thumbnails that basically forces WordPress to resize all of your images. Definitely one to check out if adding your own custom sizing.

    Anyway, once the custom sizing is added, you will be able to select it from the dropdown in the widget.

    Let me know if you have any further questions.

    Nick

    Thread Starter Sandra

    (@sandracwalsh)

    Thank you, Nick –

    I thought this might be the case. Given that this is a site for an artist, all the images uploaded will be different aspect ratios and sizes.

    I will create CUSTOM images to use for these Widgets so that they are all the same aspect ratio.

    Thanks so much for the very speedy reply!
    All the best,
    Sandra

    Plugin Author Nick Diego

    (@ndiego)

    Hi Sandra,

    Yeah I think that is the best approach. I often specify 2-5 different custom image sizes depending on the website and then name them to make it easy for clients, i.e. Featured Image, Homepage Banner Image, etc.

    Let me know if you run into any issues.

    Best,
    Nick

    Thread Starter Sandra

    (@sandracwalsh)

    Made the changes – Looks great now – thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to get image to fill top of widget’ is closed to new replies.