CMS Development

Anonymous
適用対象外

function to resize images not working as expected

解決

Trying to tap into the resize image feature for our blog feed to serve up a better image size for performance: https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#resize-image-url

 

Currently using this approach: 

<img src="{{ resize_image_url(content.post_list_summary_featured_image, 740 ) }}" width="740" class="post-listing img">

the returned src images are full size though - anyone happen to have any ideas on how to remedy? 

0 いいね!
1件の承認済みベストアンサー
stefen
解決策
キーアドバイザー | Solutions Partner
キーアドバイザー | Solutions Partner

function to resize images not working as expected

解決

@Anonymous it looks like you're using it correctly. You could try adding all 3 arguments to see if that helps. e.g.:

<img src="{{ resize_image_url(content.post_list_summary_featured_image, 0, 0, 740 ) }}" width="740" class="post-listing img">

 I have noticed sometimes if the filename has a bunch of funky characters in it or if it's an animated GIF, it will not resize the image. Hope that helps!

Stefen Phelps, Community Champion, Kelp Web Developer

元の投稿で解決策を見る

3件の返信
JBrake
投稿者 | Elite Partner
投稿者 | Elite Partner

function to resize images not working as expected

解決
{{ resize_image_url(content.post_list_summary_featured_image, 0, 0, 740) }} should be correct.

For a long time I didn't think this function was working, but what I noticed one day is it can take a couple of minutes before the new sized image is available, in which case it will return the full sized image until then - so no broken images while that occurs.
 
stefen
解決策
キーアドバイザー | Solutions Partner
キーアドバイザー | Solutions Partner

function to resize images not working as expected

解決

@Anonymous it looks like you're using it correctly. You could try adding all 3 arguments to see if that helps. e.g.:

<img src="{{ resize_image_url(content.post_list_summary_featured_image, 0, 0, 740 ) }}" width="740" class="post-listing img">

 I have noticed sometimes if the filename has a bunch of funky characters in it or if it's an animated GIF, it will not resize the image. Hope that helps!

Stefen Phelps, Community Champion, Kelp Web Developer
kestrada
HubSpot進行役
HubSpot進行役

function to resize images not working as expected

解決

Hi @Anonymous,

Thanks for posting your question. 

 

I found some ideas related to this and a great explanation related to the resize option, here.

 

I hope these ideas help you achieve your resized image.

Regards,

Kira

0 いいね!