]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions2.php
Add width/height attribute to image enclosures
[tt-rss.git] / include / functions2.php
index 507c5343e46e0c3cca80106160cb000595cc885b..07024d38fadf00cfaf924f73b36bdd73b25d7679 100644 (file)
                return $rv;
        }
 
-       function save_email_address($email) {
+       /* function save_email_address($email) {
                // FIXME: implement persistent storage of emails
 
                if (!$_SESSION['stored_emails'])
 
                if (!in_array($email, $_SESSION['stored_emails']))
                        array_push($_SESSION['stored_emails'], $email);
-       }
+       } */
 
 
        function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) {
                                $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"])."\"
                curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Firefox/5.0');
                curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
                curl_setopt($curl, CURLOPT_HEADER, true);
+               curl_setopt($curl, CURLOPT_NOBODY, true);
                curl_setopt($curl, CURLOPT_REFERER, $url);
                curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
                curl_setopt($curl, CURLOPT_AUTOREFERER, true);