$src = $_SERVER["DOCUMENT_ROOT"].$main_article["DETAIL_PICTURE"]["SRC"];
//echo $src;
$info = pathinfo($src);
$img = imageCreateFromJpeg($src);
imageWebp($img, $info['dirname'] . '/' . $info['filename'] . '.' . 'webp', 100);
imagedestroy($img);
<img src="">