Rectangular images and square thumbnails

  • I am using featured images with a fixed width but varying heights – sometimes square but sometimes the height is less than width.

    In my media settings I have set Large to 735 x 735 max, Medium to 300 x 300 max, and Thumbnail to 150 x 150. I was hoping this would mean that if the featured image wasn’t square, the thumbnail would automatically crop to produce a square image.

    But it doesn’t seem to. I think I recall that automatic cropping was sometimes possible in the old WordPress, though I never used it so I am a little vague about that. But is there any simple way to make it work the way I have described please?

    Thanks.

    The blog I need help with is: (visible only to logged in users)

  • Hi! Autocropping is possible, but it’s usually a feature of your theme, plugin, or block.

    Could you send a link to the affected page? We’ll see if you have any built in options.

  • Hi supernovia, thanks for taking an interest in this matter.

    One of the affected pages is https://hughesfacts.com/fact-sheets/, and I am using the Perle theme.

    I am still interested in the question, but I have found a CSS workaround. Perle theme gives the thumbnails a class, so I can style that class:

    .display-posts-listing img {
    	object-fit: cover;
    	width: 100px;
    	height: 100px;
    	margin-top: 6px;
    }

    I had never heard of object-fit before, but I found it on the web.

    So I’m all god, thanks. If there is another way, I’d be interested to know, but not if it takes you time. Thanks.

  • Actually, I’m all “good”, not “god”. :)

  • Thanks for letting us know you figured it out.

    Also note that your plan gives you access to both live chat and direct email support. You can reach those at any time by clicking the Help icon that appears bottom-right on all the My Sites pages, or else via the direct link at https://wordpress.com/help/contact

  • The topic ‘Rectangular images and square thumbnails’ is closed to new replies.