$filesize = strlen($img_str);
- $tempfile = tempnam(get_temppath(), "cache");
+ if (function_exists("getimagesizefromstring"))
+ $data = getimagesizefromstring($img_str);
+ else {
+ $tempfile = tempnam(get_temppath(), "cache");
- $a = get_app();
- $stamp1 = microtime(true);
- file_put_contents($tempfile, $img_str);
- $a->save_timestamp($stamp1, "file");
+ $a = get_app();
+ $stamp1 = microtime(true);
+ file_put_contents($tempfile, $img_str);
+ $a->save_timestamp($stamp1, "file");
- $data = getimagesize($tempfile);
- unlink($tempfile);
+ $data = getimagesize($tempfile);
+ unlink($tempfile);
+ }
if ($data)
$data["size"] = $filesize;
$a->save_timestamp($stamp1, "network");
+ if ($http_code == 0)
+ return($url);
+
if ((($curl_info['http_code'] == "301") OR ($curl_info['http_code'] == "302"))
AND (($curl_info['redirect_url'] != "") OR ($curl_info['location'] != ""))) {
if ($curl_info['redirect_url'] != "")
function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) {
require_once("include/network.php");
+ require_once("include/Photo.php");
$a = get_app();
$attr[$attribute->name] = $attribute->value;
$src = completeurl($attr["src"], $url);
- $photodata = @getimagesize($src);
+ $photodata = get_photo_info($src);
if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) {
if ($photodata[0] > 300) {
}
}
- } else {
+ } elseif ($siteinfo["image"] != "") {
$src = completeurl($siteinfo["image"], $url);
unset($siteinfo["image"]);
- $photodata = @getimagesize($src);
+ $photodata = get_photo_info($src);
if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10))
$siteinfo["images"][] = array("src"=>$src,