Title: Using generated webp&#8217;s in PHP/CSS
Last modified: May 19, 2021

---

# Using generated webp’s in PHP/CSS

 *  Resolved [Mat Gargano](https://wordpress.org/support/users/matstars/)
 * (@matstars)
 * [5 years ago](https://wordpress.org/support/topic/using-generated-webps-in-php-css/)
 * Hi there,
 * If I want to use the generated webp’s in CSS (background image) or PHP where 
   I’m either outputting a string of the URL of the webp to preload, for example.
   Is there an easy way to do so?
 * M

Viewing 1 replies (of 1 total)

 *  Plugin Author [WP Media](https://wordpress.org/support/users/wp_media/)
 * (@wp_media)
 * [5 years ago](https://wordpress.org/support/topic/using-generated-webps-in-php-css/#post-14456920)
 * Hi [@matstars](https://wordpress.org/support/users/matstars/)
 * The main problem with this approach is how to determine browsers that do not 
   support WebP and deliver the fallback image for these.
 * That’s the reason we do not apply it as we are not sure about the best way to
   handle it.
 * At this moment, the best way to implement WebP to background images is to use
   rewrite rules method (which does not work with Cloudflare/CDN so it’s another
   downside).
 * Hope this helps at least a bit, although I understand I didn’t provide a clear
   guidance.
 * Let me know what you think.
 * Best Regards
    Marko

Viewing 1 replies (of 1 total)

The topic ‘Using generated webp’s in PHP/CSS’ is closed to new replies.

 * ![](https://ps.w.org/imagify/assets/icon-256x256.gif?rev=3452959)
 * [Imagify: Optimize Images for Top Speed (Compress & Convert to WebP/AVIF)](https://wordpress.org/plugins/imagify/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/imagify/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/imagify/)
 * [Active Topics](https://wordpress.org/support/plugin/imagify/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/imagify/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/imagify/reviews/)

## Tags

 * [background images](https://wordpress.org/support/topic-tag/background-images/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [webp](https://wordpress.org/support/topic-tag/webp/)

 * 1 reply
 * 2 participants
 * Last reply from: [WP Media](https://wordpress.org/support/users/wp_media/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/using-generated-webps-in-php-css/#post-14456920)
 * Status: resolved