• I have looked and can only find settings to set a max size for Featured Images:

    set_post_thumbnail_size( 200, 200, true ); // Normal post thumbnails

    My theme uses this code. What I am trying to do, however, is set a fixed width (and height if possible). I do not want the image to be cropped, just set to 250×75 keeping the entire image visible. Is this possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter chrismo16

    (@chrismo16)

    Here’s the website for reference:

    https://www.brotherprocessing.com/partners/

    I would like all images to be the same exact size

    you have a couple options:

    you can code it… as per what you found about “thumbnail” size – there are similar functions you can add here.

    that can get a little tricky – but since you’re already delving into code, you may find it fun ??

    alternatively, you could add some css (to a child theme of course)…

    your current css is:

    img {
    max-width: 100%;
    height: auto;
    vertical-align: top;
    }

    So, currently your images automatically display at 100% of their original width, and the height is automatic.

    If you want all your images to be, for example, 250px WIDE and 125px HIGH, you can control that by css – HOWEVER – you will end up with distortion unless all your images are ALSO the same aspect ratio (in this case 1:2) More info

    and there is no argument for distorting images… just sayin.

    anyway – if you still want to force all your images to be the same size, change that css above with something like:

    img {
    width: XXXpx;
    height: YYYpx;
    vertical-align: top;
    }

    that will force your images to be X by Y, no matter what their original dimensions.

    a better approach might be to ONLY set ONE dimension – so all images are XXXpx WIDE OR YYYpx HIGH… then the aspect ratio will remain the same at least, and the only distortion will be the clarity of the image.

    keep in mind that making an image BIGGER than its original size will always look bad. It’s not so dicey getting SMALLER, but either way, you don’t want to stretch it into a disproportionate size.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set a Fixed Size for Featured Image’ is closed to new replies.