Skip Navigation

[Resuelto] Background Image Size Override

This support ticket is created hace 1 año, 5 meses. There's a good chance that you are reading advice that it now obsolete.

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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Line49 Design hace 1 año, 5 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#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?
enlace oculto

#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: enlace oculto
Frontend result:
enlace oculto

More helps:
enlace oculto

#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:
enlace oculto

Frontend result:
enlace oculto

#2617759

My issue is resolved now. Thank you!