mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 14:05:56 +00:00
better support for image srcset attributes as discussed in https://community.tt-rss.org/t/problem-with-img-srcset/3519
This commit is contained in:
@@ -1289,19 +1289,13 @@
|
||||
}
|
||||
|
||||
if ($entry->hasAttribute('srcset')) {
|
||||
$tokens = explode(",", $entry->getAttribute('srcset'));
|
||||
$matches = RSSUtils::decode_srcset($entry->getAttribute('srcset'));
|
||||
|
||||
for ($i = 0; $i < count($tokens); $i++) {
|
||||
$token = trim($tokens[$i]);
|
||||
|
||||
list ($url, $width) = explode(" ", $token, 2);
|
||||
|
||||
$url = rewrite_relative_url($rewrite_base_url, $url);
|
||||
|
||||
$tokens[$i] = "$url $width";
|
||||
for ($i = 0; $i < count($matches); $i++) {
|
||||
$matches[$i]["url"] = rewrite_relative_url($rewrite_base_url, $matches[$i]["url"]);
|
||||
}
|
||||
|
||||
$entry->setAttribute("srcset", implode(", ", $tokens));
|
||||
$entry->setAttribute("srcset", RSSUtils::encode_srcset($matches));
|
||||
}
|
||||
|
||||
if ($entry->hasAttribute('src') &&
|
||||
|
||||
Reference in New Issue
Block a user