Skip Navigation

[Resolved] Background Image Size Override

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Line49 Design 1 year, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2615183

Tell us what you are trying to do?
We use Toolset to manage dynamic content such as grids of real estate listings. Like others, we have noticed that the dynamic background images appearing in these grids cause a performance issue, since they reference the default original image at full size.

We see at the various links provided that this has been a feature request for years but is not available yet.
https://toolset.com/forums/topic/background-image-size
https://toolset.com/forums/topic/background-images
https://toolset.com/forums/topic/serving-custom-size-background-images-to-reduce-page-load-times-and-size-in-grid
https://toolset.com/forums/topic/choosing-image-size-with-toolset-image-block

However, we don't need you to rewrite your software to solve this item.

We simply need a function we can, say, paste into functions.php, which will globally override the default Full size with any other given size, such as Medium.

Can you please provide us with such a function?

What is the link to your site?
hidden link

#2615231

Hello,

You can setup the Background Image with HTML codes manually, for example:

<div class="wp-block-toolset-blocks-container tb-container" style="background: url([wpv-post-featured-image size="medium" output="url"]) center center no-repeat;background-size: 300px 156px;">
<p>test </p>
</div>

See below sandbox website:
Login URL: hidden link
Frontend result:
hidden link

More helps:
hidden link

#2615919
Screenshot 2023-06-14 103315.png

Thank you for your quick response!

We are using blocks, I will attach a screen capture, to show the structure of the blocks, the container in question is highlighted. I'm not sure how to use the provided shortcode.
Also we have multiple views very similar with the attached example.
So best for us would be to use a function, which will globally override the default Full size with any other given size, such as Medium.

Thanks again for your help,
Ligia

#2616017

Unfortunately, there isn't such kind of built-in feature or function within Toolset Blocks plugin, you just need to add two custom HTML blocks, and display the HTML div tag, for example:

<div class="wp-block-toolset-blocks-container tb-container" style="background: url([wpv-post-featured-image size="medium" output="url"]) center center no-repeat;background-size: 300px 156px; width:300px; height:156px;">
</div>

And wrap other contents into above custom HTML blocks, see the sandbox website:
hidden link

Frontend result:
hidden link

#2617759

My issue is resolved now. Thank you!