]> git.wh0rd.org Git - tt-rss.git/commitdiff
Add width/height attribute to image enclosures
authorFelix Eckhofer <felix@eckhofer.com>
Tue, 15 Jul 2014 13:44:05 +0000 (15:44 +0200)
committerFelix Eckhofer <felix@eckhofer.com>
Tue, 15 Jul 2014 14:23:49 +0000 (16:23 +0200)
include/functions2.php

index 3e33672402f0ccd6ea0d33096ceae03ec79bebbf..07024d38fadf00cfaf924f73b36bdd73b25d7679 100644 (file)
                                $url = $line["content_url"];
                                $ctype = $line["content_type"];
                                $title = $line["title"];
+                               $width = $line["width"];
+                               $height = $line["height"];
 
                                if (!$ctype) $ctype = __("unknown type");
 
                                $entry["filename"] = $filename;
                                $entry["url"] = $url;
                                $entry["title"] = $title;
+                               $entry["width"] = $width;
+                               $entry["height"] = $height;
 
                                array_push($entries, $entry);
                        }
                                                                preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) {
 
                                                                if (!$hide_images) {
+                                                                       $encsize = '';
+                                                                       if ($entry['height'] > 0)
+                                                                               $encsize .= ' height="' . intval($entry['width']) . '"';
+                                                                       if ($entry['width'] > 0)
+                                                                               $encsize .= ' width="' . intval($entry['height']) . '"';
                                                                        $rv .= "<p><img
                                                                        alt=\"".htmlspecialchars($entry["filename"])."\"
-                                                                       src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
+                                                                       src=\"" .htmlspecialchars($entry["url"]) . "\"
+                                                                       " . $encsize . " /></p>";
                                                                } else {
                                                                        $rv .= "<p><a target=\"_blank\"
                                                                        href=\"".htmlspecialchars($entry["url"])."\"