-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect enclosure as images using file extension #3861
Conversation
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 FreshRSS#3805
39e2a32
to
a156529
Compare
app/Models/Feed.php
Outdated
@@ -410,7 +410,8 @@ public function loadEntries($simplePie) { | |||
$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('/[.](gif|jpe?g|png|svg)$/i', $elink)))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably also add WebP and that new one based on AV1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 5fd913d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot about APNG earlier btw, and fwiw there's also BMP.
Indeed, and several more, cf. e.g. https://developer.mozilla.org/docs/Web/Media/Formats/Image_types , but this is just a fallback for cases not providing any other type hint |
Support e.g. https://www.sciencesetavenir.fr/atom.xml , which does not include any type hint:
Useful for #3805