function imglazy($filen,$altn,$classn) {
    global $imagepath;
    global $cdnsource;
echo '<picture>
<source media="(min-width: 1025px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-fl.webp"
    type="image/webp">
<source media="(max-width: 1024px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-bg.webp"
    type="image/webp">
<source media="(max-width: 768px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-md.webp"
    type="image/webp">
<source media="(max-width: 480px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-sm.webp"
    type="image/webp">

<source media="(min-width: 1025px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-fl.jpg"
    type="image/jpeg">
<source media="(max-width: 1024px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-bg.jpg"
    type="image/jpeg">
<source media="(max-width: 768px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-md.jpg"
    type="image/jpeg">
<source media="(max-width: 480px)"
    data-srcset="'.$cdnsource.$imagepath.$filen.'-sm.jpg"
    type="image/jpeg">
<img
    data-srcset="'.$cdnsource.$imagepath.$filen.'-bg.jpg,
        '.$cdnsource.$imagepath.$filen.'-md.jpg,
        '.$cdnsource.$imagepath.$filen.'-sm.jpg"
    data-src="'.$cdnsource.$imagepath.$filen.'-fl.jpg"
    alt="'.$altn.'"
    class="lazyload '.$classn.'">
</picture>';
}
Merhaba yukarıdaki gibi bir fonksiyon oluşturdum. Bu fonksiyon ile resimlerimi ekrana bastırıyorum. Fakat sorunum mobilden denediğimde -bg olan yapımı alıyor. Ama -sm olanı kullanması gerekmiyor mu? Nerde hata yapıyorum.