Site logo

[Resolved] Is it possible to use WebP images as header element background?

Home Forums Support [Resolved] Is it possible to use WebP images as header element background?

Home Forums Support Is it possible to use WebP images as header element background?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1821922
    Elizabeth

    Hi! I’m working on a new website that uses header elements with background images. All images in the image library have a corresponding .webp version.

    Is it possible to use the WebP versions of the images in the Background Element in the header elements? Here’s an example page https://itfpharma.candyappledev.com/therapeutic-areas/.

    Thanks,
    Liza

    #1822002
    Ying
    Staff
    Customer Support

    Hi Elizabeth,

    If the Webp image has already been uploaded to media, you should be able to select it as the background image in the header element.

    Let me know if you need further assistance 🙂

    #1822131
    Elizabeth

    Hi Ying,

    Thank you for getting back to me so quickly. I’m using Imagify to generate WebP versions of the images. I don’t have an option of which version of the file to use when I’m editing the header elements.

    Liza

    #1822235
    Elvin
    Staff
    Customer Support

    Hi Elizabeth,

    I believe Imagify can’t convert images displayed through background-image CSS property.

    The way to go about this if you wish to use webp as background image is to either:

    Manually convert the image into webp format, re-upload it to media library and re-apply it to where you want it applied.

    Or,

    Ask Imagify what function from their plugin outputs the URL webp image and use that for the PHP code snippet write-up in generating a new CSS to use that webp image URL as background image.

    The PHP coding writeup will be simple. I can help you with that but we’re not exactly sure how Imagify outputs the webp URL. It’s a third-party plugin so it’s out of our scope, unfortunately.

    #1822776
    Elizabeth

    Hi Elvin,

    Thank you for helping to clarify this. Imagify simply adds .webp to the end of the original file – for example https://itfpharma.candyappledev.com/wp-content/uploads/2021/04/Womens-Health-Header.jpg.webp.

    I appreciate your help with the PHP code to accomplish this.

    Elizabeth

    #1822834
    David
    Staff
    Customer Support

    Hi there,

    have you checked with Imagify ? I believe they have a Rewrite Rules Method in the plugin that will allow CSS Background images to be converted.

    #1823194
    Elizabeth

    Hi David,

    No, I haven’t checked with Imagify, but should have thought of it. I’ll check now and let you know what I find out.

    Thanks,
    Elizabeth

    #1823200
    Elizabeth

    Hi David,

    Imagify does have an rewrite rules setting, which I completely overlooked, and it did the trick. Thank you for thinking of this!

    Elizabeth

    #1823410
    David
    Staff
    Customer Support

    Glad to be of help

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.