+ ($height > $attachments[$filetype]['height']) && ($attachments[$filetype]['height'] >= 480)) {
+ continue;
+ }
+
+ $attachments[$filetype] = ['type' => $mediatype, 'url' => $href, 'height' => $height, 'size' => $size];
+ } elseif (in_array($mediatype, ['application/x-bittorrent', 'application/x-bittorrent;x-scheme-handler/magnet'])) {
+ $height = (int)JsonLD::fetchElement($url, 'as:height', '@value');
+
+ // For Torrent links we always store the highest resolution
+ if (!empty($attachments[$mediatype]['height']) && ($height < $attachments[$mediatype]['height'])) {