aboutsummaryrefslogtreecommitdiffstats
path: root/mod/parse_url.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-09-09 21:17:06 -0700
committerfriendica <info@friendica.com>2012-09-09 21:17:06 -0700
commit3ebb4a3dc7a369e7a716ab93d02b44b20522080f (patch)
tree5b8daecf7a29c6fe2f0c8572204d9e2bd1713a50 /mod/parse_url.php
parenta08666be142c484134c2f10cf0c460c8a3c07682 (diff)
downloadvolse-hubzilla-3ebb4a3dc7a369e7a716ab93d02b44b20522080f.tar.gz
volse-hubzilla-3ebb4a3dc7a369e7a716ab93d02b44b20522080f.tar.bz2
volse-hubzilla-3ebb4a3dc7a369e7a716ab93d02b44b20522080f.zip
updates
Diffstat (limited to 'mod/parse_url.php')
-rw-r--r--mod/parse_url.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/mod/parse_url.php b/mod/parse_url.php
index ea05055f0..083a39b55 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -36,6 +36,9 @@ function completeurl($url, $scheme) {
if ($schemearr["port"] != "")
$complete .= ":".$schemearr["port"];
+ if(strpos($urlarr['path'],'/') !== 0)
+ $complete .= '/';
+
$complete .= $urlarr["path"];
if ($urlarr["query"] != "")
@@ -149,17 +152,17 @@ function parseurl_getsiteinfo($url) {
}
if ($siteinfo["image"] == "") {
- $list = $xpath->query("//img[@src]");
- foreach ($list as $node) {
- $attr = array();
- if ($node->attributes->length)
- foreach ($node->attributes as $attribute)
- $attr[$attribute->name] = $attribute->value;
+ $list = $xpath->query("//img[@src]");
+ foreach ($list as $node) {
+ $attr = array();
+ if ($node->attributes->length)
+ foreach ($node->attributes as $attribute)
+ $attr[$attribute->name] = $attribute->value;
$src = completeurl($attr["src"], $url);
- $photodata = getimagesize($src);
+ $photodata = @getimagesize($src);
- if (($photodata[0] > 150) and ($photodata[1] > 150)) {
+ if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) {
if ($photodata[0] > 300) {
$photodata[1] = round($photodata[1] * (300 / $photodata[0]));
$photodata[0] = 300;
@@ -173,15 +176,15 @@ function parseurl_getsiteinfo($url) {
"height"=>$photodata[1]);
}
- }
- } else {
+ }
+ } else {
$src = completeurl($siteinfo["image"], $url);
unset($siteinfo["image"]);
- $photodata = getimagesize($src);
+ $photodata = @getimagesize($src);
- if (($photodata[0] > 10) and ($photodata[1] > 10))
+ if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10))
$siteinfo["images"][] = array("src"=>$src,
"width"=>$photodata[0],
"height"=>$photodata[1]);