Bugfix: Sometimes uploaded pictures weren't posted correctly to other networks
This commit is contained in:
parent
db99ce9512
commit
5580c0d708
2 changed files with 13 additions and 4 deletions
|
@ -823,9 +823,12 @@ function get_photo_info($url) {
|
||||||
|
|
||||||
$data = Cache::get($url);
|
$data = Cache::get($url);
|
||||||
|
|
||||||
if (is_null($data)) {
|
// Unserialise to be able to check in the next step if the cached data is alright.
|
||||||
$img_str = fetch_url($url, true, $redirects, 4);
|
if (!is_null($data))
|
||||||
|
$data = unserialize($data);
|
||||||
|
|
||||||
|
if (is_null($data) OR !$data) {
|
||||||
|
$img_str = fetch_url($url, true, $redirects, 4);
|
||||||
$filesize = strlen($img_str);
|
$filesize = strlen($img_str);
|
||||||
|
|
||||||
if (function_exists("getimagesizefromstring"))
|
if (function_exists("getimagesizefromstring"))
|
||||||
|
@ -846,8 +849,7 @@ function get_photo_info($url) {
|
||||||
$data["size"] = $filesize;
|
$data["size"] = $filesize;
|
||||||
|
|
||||||
Cache::set($url, serialize($data));
|
Cache::set($url, serialize($data));
|
||||||
} else
|
}
|
||||||
$data = unserialize($data);
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,13 @@ function get_attached_data($body) {
|
||||||
if (count($pictures) == 1) {
|
if (count($pictures) == 1) {
|
||||||
// Checking, if the link goes to a picture
|
// Checking, if the link goes to a picture
|
||||||
$data = parseurl_getsiteinfo_cached($pictures[0][1], true);
|
$data = parseurl_getsiteinfo_cached($pictures[0][1], true);
|
||||||
|
|
||||||
|
// Workaround:
|
||||||
|
// Sometimes photo posts to the own album are not detected at the start.
|
||||||
|
// So we seem to cannot use the cache for these cases. That's strange.
|
||||||
|
if (($data["type"] != "photo") AND strstr($pictures[0][1], "/photos/"))
|
||||||
|
$data = parseurl_getsiteinfo($pictures[0][1], true);
|
||||||
|
|
||||||
if ($data["type"] == "photo") {
|
if ($data["type"] == "photo") {
|
||||||
$post["type"] = "photo";
|
$post["type"] = "photo";
|
||||||
if (isset($data["images"][0])) {
|
if (isset($data["images"][0])) {
|
||||||
|
|
Loading…
Reference in a new issue