summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-02-05 13:13:51 +0300
committerAndrew Dolgov <[email protected]>2010-02-05 13:13:51 +0300
commit44cfa02554c9f928ecd505f5ff05daae550daea9 (patch)
treee8cc29d122d0a1ac579102fabe4b7a36f5005566
parent3393238de25981525ca816391b8e94274d94a3f8 (diff)
better image attachment detection for inlining
-rw-r--r--functions.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/functions.php b/functions.php
index 86712f01b..abd1f20d5 100644
--- a/functions.php
+++ b/functions.php
@@ -4920,19 +4920,22 @@
print "<div class=\"postEnclosures\">";
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"])) {
- print "<p><img
+
+ if (preg_match("/image/", $entry["type"]) ||
+ preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) {
+
+ print "<p><img
alt=\"".htmlspecialchars($entry["filename"])."\"
- src=\"" .htmlspecialchars($entry["url"]) . "\"></p>";
+ src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
}
}
}
}
- print "<div class=\"postEnclosures\">";
-
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 "<p><img
alt=\"".htmlspecialchars($entry["filename"])."\"
src=\"" .htmlspecialchars($entry["url"]) . "\"></p>";