public function Webp::getWebpSrcset in WebP 8
Receives the srcset string of an image and returns the webp equivalent.
Parameters
string $srcset: Srcset to convert to .webp version
Return value
string Webp version of srcset
File
- src/
Webp.php, line 179
Class
- Webp
- Class Webp.
Namespace
Drupal\webpCode
public function getWebpSrcset($srcset) {
return preg_replace('/\\.(png|jpg|jpeg)(\\?.*?)?(,| |$)/i', '.webp\\2\\3', $srcset);
}