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 | |
/** | |
* Taruh di functions.php paling bawah | |
*/ | |
/** | |
* Mengubah Semua URL image di konten menjadi berCDN | |
*/ | |
function cdn_on_the_fly($content) { | |
$pattern = '#(\-(\d+)x(\d+))?\.((?:jpg|gif|png|webp|jpeg))#'; | |
return preg_replace($pattern, '.$4?format=webp&quality=80&w=$2&h=$3', $content); |