CMS Development

SJaeger
Contributor

disable image resize if height and width is given

SOLVE

Hello,

 

have someone see the possibility to disable the auto resize hubspot function if the image height and width attribute is given?

because i need only a 270px image. if i give the right width and height attribute hubspot make automaticly a srcset instead of src attribute. same on picture tags, where i dont want srcset on img tags.

 

 

Nothing is impossible
0 Upvotes
1 Accepted solution
piersg
Solution
Key Advisor

disable image resize if height and width is given

SOLVE

These both worked for me in preventing Hubspot from adding srcset and automatic resizing parameters:

 

<img src="{{ resize_image_url(item.image.src ~ '?noresize', 270, 0, 270) }}" {{sizeAttrs}}>
<img src="{{item.image.src}}?noresize" {{sizeAttrs}}>

 

 

For the record, I see you've written your img src as item.image.url but the parameter of the image tag in Hubspot you need is item.image.src

View solution in original post

0 Upvotes
4 Replies 4
piersg
Key Advisor

disable image resize if height and width is given

SOLVE

Hi @SJaeger (thanks @Jaycee_Lewis). Yes, this is possible. Just add ?noresize to the end of the image src e.g.

<img src="{{module.img.src}}?noresize" alt="{{module.img.alt}}" height="{{module.img.height}}" width="{{module.img.width}}">

 

SJaeger
Contributor

disable image resize if height and width is given

SOLVE

hello and thanks but still not working

<img class="img-fluid w-100" src="{{ resize_image_url(item.image.url ~ '?noresize', 270, 0, 270) }}" alt="{{ item.name|escape }}" {{ sizeAttrs }} loading="lazy">
{% require_head %}
<link rel="preload" as="image" href="{{ resize_image_url(item.image.url, 270, 0, 270) }}">
{% end_require_head %}
Nothing is impossible
0 Upvotes
piersg
Solution
Key Advisor

disable image resize if height and width is given

SOLVE

These both worked for me in preventing Hubspot from adding srcset and automatic resizing parameters:

 

<img src="{{ resize_image_url(item.image.src ~ '?noresize', 270, 0, 270) }}" {{sizeAttrs}}>
<img src="{{item.image.src}}?noresize" {{sizeAttrs}}>

 

 

For the record, I see you've written your img src as item.image.url but the parameter of the image tag in Hubspot you need is item.image.src

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

disable image resize if height and width is given

SOLVE

Hey, @SJaeger 👋 Thanks for the great question! @Oezcan and @piersg do you have any experience here with what @SJaeger is trying to accomplish?

 

Thank you! – Jaycee





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes