Alternate sizes in repeater elements

I have a repeater element that contains a background image that comes from a page header hero type on a dynamic page. When the image is used on the dynamic page it is a large full-width type, but when used in the repeater i need it to be in a 1:1 ratio - what would be the preferred way to accomplish this?

I saw a solution using custom js in the header to find that repeater and add some height css, that feels awful, just curious if there is a better approach.