[Support request] Maintain width / height of image?

Home Forums Support [Support request] Maintain width / height of image?

Home Forums Support Maintain width / height of image?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1942844
    Jack

    Hey guys,

    Is it possible, when using image blocks in containers, to maintain the width / height of an image, no matter what size image you choose? So, for example, you have three 600 x 600 images side by side, but you want to quickly replace one of the images with a 800 x 900 image.. can you automatically ‘crop’ or ‘contain’ that image to fit and be 600 x 600 like the rest?

    #1942911
    David
    Staff
    Customer Support

    Hi there,

    2 options:

    1. Is to use CSS to force the images to display at that size, which would treat them like a background image. If i can see the site i can provide some CSS for that.

    2. Create a new image size that is 600 x 600 cropped, that can then be selected in the Image Block – see here:

    https://docs.generatepress.com/article/adding-image-sizes/

    Option 2 would make the most sense.

    #1943039
    Jack

    Hey David,

    Thank you for the prompt response.

    I like the sound of option 2. I’ve added the function into my Code Snippets plugin, but it’s not showing up as an option on the image block settings? I still only see ‘Thumbnail; Small; Medium; Large & Full Size’.

    #1943040
    Jack

    Just to add, I notice the the article on functions you sent is categorised as a ‘blog’ function, but I wish to use this on normal pages image blocks too. Is this possible?

    #1943107
    David
    Staff
    Customer Support

    Ah that doc is a little misleading – we reference the Blog module as its the only place in GPP where you can set an image size. But adding that function ( and running the Regenerate Thumbnails plugin ) will create new image sizes that can be used for any image on the site… not just in the GPP blog settings.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.