CMS Development

SJaeger
投稿者

disable image resize if height and width is given

解決

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 いいね!
1件の承認済みベストアンサー
piersg
解決策
キーアドバイザー

disable image resize if height and width is given

解決

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 いいね!
4件の返信
piersg
キーアドバイザー

disable image resize if height and width is given

解決

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
投稿者

disable image resize if height and width is given

解決

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 いいね!
piersg
解決策
キーアドバイザー

disable image resize if height and width is given

解決

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 いいね!
Jaycee_Lewis
コミュニティーマネージャー
コミュニティーマネージャー

disable image resize if height and width is given

解決

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 いいね!