The function "get_attached_data" hasn't always detected photos
This commit is contained in:
parent
6541247bd3
commit
4e6e09a44f
|
@ -53,7 +53,6 @@ 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($pictures[0][1], true);
|
$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]))
|
||||||
|
@ -64,8 +63,7 @@ function get_attached_data($body) {
|
||||||
$post["preview"] = $pictures[0][2];
|
$post["preview"] = $pictures[0][2];
|
||||||
$post["text"] = str_replace($pictures[0][0], "", $body);
|
$post["text"] = str_replace($pictures[0][0], "", $body);
|
||||||
} else {
|
} else {
|
||||||
$img_str = fetch_url($pictures[0][1]);
|
$imgdata = get_photo_info($pictures[0][1]);
|
||||||
$imgdata = get_photo_info($img_str);
|
|
||||||
if (substr($imgdata["mime"], 0, 6) == "image/") {
|
if (substr($imgdata["mime"], 0, 6) == "image/") {
|
||||||
$post["type"] = "photo";
|
$post["type"] = "photo";
|
||||||
$post["image"] = $pictures[0][1];
|
$post["image"] = $pictures[0][1];
|
||||||
|
|
Loading…
Reference in a new issue