From: Andrew Dolgov Date: Fri, 5 Feb 2010 10:13:51 +0000 (+0300) Subject: better image attachment detection for inlining X-Git-Tag: 1.4.1~17 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=44cfa02554c9f928ecd505f5ff05daae550daea9;p=tt-rss.git better image attachment detection for inlining --- diff --git a/functions.php b/functions.php index 86712f01..abd1f20d 100644 --- a/functions.php +++ b/functions.php @@ -4920,19 +4920,22 @@ print "
"; if (!get_pref($link, "STRIP_IMAGES")) { - if ($always_display_enclosures || !preg_match("/\"".htmlspecialchars($entry["filename"])."\"

"; + src=\"" .htmlspecialchars($entry["url"]) . "\"/>

"; } } } } - print "
"; - if (db_num_rows($result) == 1) { print __("Attachment:") . " "; } else { @@ -5501,9 +5504,12 @@ $always_display_enclosures = db_fetch_result($tmp_result, 0, "always_display_enclosures"); if (!get_pref($link, "STRIP_IMAGES")) { - if ($always_display_enclosures || !preg_match("/img/i", $article_content)) { + if ($always_display_enclosures || + !preg_match("/img/i", $article_content)) { + foreach ($entries as $entry) { - if (preg_match("/image/", $entry["type"])) { + if (preg_match("/image/", $entry["type"]) || + preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) { print "

\"".htmlspecialchars($entry["filename"])."\"

";