Last active
May 24, 2022 05:55
-
-
Save jangaraev/a8be08ab90f19f44cce66c3657ae0d5a to your computer and use it in GitHub Desktop.
Check if browser supports webp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// plain PHP solution | |
$supportsWebp = strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false; | |
// Laravel solution | |
$supportsWebp = request()->accepts('image/webp'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment