diff options
| author | 2021-09-27 22:24:26 +0200 | |
|---|---|---|
| committer | 2021-09-27 22:24:26 +0200 | |
| commit | a473b90ff9533687e1347aed0d3b9ceaa5e66aab (patch) | |
| tree | b557a22a93be6181a807382c460365d11a4d8cf7 /app/Models/Feed.php | |
| parent | 8154ecf7356e3162f81edbf81760e2df06d1e028 (diff) | |
Detect enclosure as images using file extension (#3861)
* Detect enclosure as images using file extension
Support e.g. https://www.sciencesetavenir.fr/atom.xml , which does not include any type hint.
```html
<link rel="enclosure" href="https://example.net/assets/img/ZZZ.jpg" title="YYY"/>
```
Useful for https://github.com/FreshRSS/FreshRSS/pull/3805
* Add AVIF and WebP
Diffstat (limited to 'app/Models/Feed.php')
| -rw-r--r-- | app/Models/Feed.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 423b913b0..a0bf8f353 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -410,7 +410,8 @@ class FreshRSS_Feed extends Minz_Model { $height = $enclosure->get_height(); $width = $enclosure->get_width(); $length = $enclosure->get_length(); - if ($medium === 'image' || strpos($mime, 'image') === 0 || ($mime == '' && $length == null && ($width != 0 || $height != 0))) { + if ($medium === 'image' || strpos($mime, 'image') === 0 || + ($mime == '' && $length == null && ($width != 0 || $height != 0 || preg_match('/[.](avif|gif|jpe?g|png|svg|webp)$/i', $elink)))) { $enclosureContent .= '<p class="enclosure-content"><img src="' . $elink . '" alt="" /></p>'; } elseif ($medium === 'audio' || strpos($mime, 'audio') === 0) { $enclosureContent .= '<p class="enclosure-content"><audio preload="none" src="' . $elink |
