Prevent automatic resizing

Hi there,

I’m trying to implement preloading for hero images but running into issues with the automatic resizing feature. I’ve followed this example: https://community.hubspot.com/t5/CMS-Development/Strip-Image-Height-and-Width-from-source-variable/m-p/526689 but for some reason HubSpot is STILL adding the “?width=x&height=x&name=x” even though I’ve used the split function to cut it out. I’ve likewise tried the ?noresize queryparam and when I test it by using {{ img_src }} outside of the image tag it’s fine and appears correctly, but inside the img tag it’s STILL adding the same queryparams which will not work with preloading. I can’t simply remove the height and width attributes from the tag.

This is what it looks like even after trying both the split function and the ?noresize queryparam:

SBurnett28_0-1693408605161.png

As you can see, it simply gets added in between the file and the rest of the queryparams. I don’t understand what’s happening here. It’s really frustrating.

Can anyone give me some tips on how to stop HubSpot from altering the url completely, or implementing preloading? Thanks.

Hi, @SBurnett28 :waving_hand: Thanks for your question. Including the link to the guide you are using is always helpful. Can you share a code block example or live page, of how you implemented the solution @Teun provided?

Without having more context, it’s challenging for the community to give a suggestion or reply.

Best,

Jaycee

Option 1 using the split filter as seen in the forum post I linked above:

SBurnett28_1-1693526406043.png

Output of {{ image_url }} as expected:

SBurnett28_5-1693526523003.png

Preload link:

SBurnett28_2-1693526420951.png

What the module is actually outputting:

As you can see, the url is not the same as the preload even though the filter should cut the resizing parameter out, which it is doing outside of the img tag but not in the img tag where I need it to be cut.

Option 2 using ?noresize (https://knowledge.hubspot.com/files/automatic-image-resizing-on-hubspot-content😞

SBurnett28_6-1693526681900.png

SBurnett28_7-1693526700137.png

As you can see, the ?noresize parameter is actually preventing the additional srcset and sizes attributes, but it’s still altering the url by adding the width, height, and name queryparams which is at odds with the preload url.