Repeater fixedWidth Image Formatting Issue (only on publish, fine in Preview)

Hello! Very novice Wix user here struggling with my repeater images.

I’m trying to load the images in my repeater in such a way that they fit the width of the repeated container but their heights are allowed to vary to preserve the proportions of each image. I tried incorporating a line of code within the repeater1_itemReady () function that specified $w(“#productimage”).fitMode = “fixedWidth”.

In the Preview Mode, this looks great and functions as I’d hope it would (see first image) but when I publish the link, the images end up centered in very stretched containers surrounded by blocks of empty space (see second image). If I remove the fixedWidth line the containers return to the correct size but the images are cropped to fit the set dimensions (see the owl photo in third image).

Any thoughts on where I’m going wrong? Thank you so much for your help!

Image Formatting in Preview Mode

Image Formatting when Published with fixedWidth line

Image Formatting when Published without fixedWidth line