loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
$images = $dom->getElementsByTagName('img');
$loop = 1;
$imgRoot = "/var/www/html/htknews";
foreach ($images as $img) {
if ($loop > 1) $img->setAttribute('loading', 'lazy');
$img->removeAttribute('style');
$src = $img->getAttribute('src');
if (file_exists($imgRoot.$src)) {
$srcWebp = tryWebP($src, NULL);
$img->setAttribute('src', $srcWebp);
$img->setAttribute('width', 828);
$img->setAttribute('height', getImgHeight($srcWebp, 828));
}
$loop++;
}
return $dom->saveHTML();
}
//
$newsHTML = file_get_contents($file_path.$r['yr'].'/'.$r['mth'].'/'.$r['news_id'].'/'.$r['news_level'].'.html');
$newsHTML = addImageDimensions($newsHTML);
echo $newsHTML;
?>
0) {
$tgs_count = $tgs_count-1;
echo "
TAGS: ";
for ($tIndex=0; $tIndex<=$tgs_count; $tIndex++) {
$t = $tag_items[$tIndex];
echo "{$t}";
if ($tgs_count != $tIndex) echo ", ";
}
echo "
";
}
?>