Is there a pendant to resize_image_url() for React directly?
Because Breeze is 100% sure, that if I only add ?width=200 to the url of the Image. Hubspot will resize it. But this is not the case. Is there any other posibillity except HublData?
Hi @DMarketing328,
Thank you for posting to the Community!
I’d like to tag in some Subject Experts to see if they can offer any guidance here -- Hi @miljkovicmisa@MBERARD and @Indra Do any of you have any tips for @DMarketing328?
Thank you!
Cassie, Community Manager
It’s strange that this option isn’t available directly in the image field. Or did I misconfigure something?
Also it’s not working if i rewrite the src url. Becaus now it takes the url of the Hubspot CDN and not the url from my domain.
I don’t think it’s misconfiguration, it’s just not an obvious “setting”.
When an image module is used and the Size control is left as “Automatically adjust”, then the image seems to be consistently served with only “/hubfs/” but when then size is specified, the URL automatically changes to “/hs-fs/hubfs/”
There is no direct React or JavaScript equivalent to resize_image_url().
The function is server-side only, part of the HubL templating engine.
Adding ?width=200 or ?resized=… only works for certain HubSpot-hosted image URLs (those served from the HubSpot File CDN with specific patterns like f.hubspotusercontent), and even then, not always consistently, it depends on the file source and CDN version.
In a React app, unless HubSpot provides an image resizing endpoint, you can’t force HubSpot’s CDN to resize it just by adding query params.
So possibly within a HubSpot theme/module, wrap your React component in a HubL template so the URL can be pre-resized server-side via resize_image_url().
Hope this helps, if it does then help the community by marking it as a solution and giving a upvote.
Happy HubSpotting.
Thanks & Regards,
Dilshad Shaikh