From b43dd28b7af2f40726a6eb50a7d26be9438fa202 Mon Sep 17 00:00:00 2001 From: root <17hado.com@gmail.com> Date: Sun, 16 Dec 2018 06:16:45 +0000 Subject: [PATCH] closes #6272 --- doc/api.md | 12 ++++++++++++ include/api.php | 4 +--- tests/include/ApiTest.php | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/api.md b/doc/api.md index 2715f44462..0f2243b5c1 100644 --- a/doc/api.md +++ b/doc/api.md @@ -379,6 +379,18 @@ Friendica doesn't allow showing the friends of other users. * media: image data +#### Return values + +Object of: + +* media_id: a media identifier (integer) +* media_id_string: a media identifier (string) +* size: size in byte +* image.w: image width +* image.h: image height +* image.image_type: image mime type +* image.friendica_preview_url: image preview url + --- ### oauth/request_token (*) diff --git a/include/api.php b/include/api.php index 8a89d00d77..1fca796670 100644 --- a/include/api.php +++ b/include/api.php @@ -945,7 +945,6 @@ function api_format_data($root_element, $type, $data) $ret = $data; break; } - return $ret; } @@ -1244,7 +1243,7 @@ function api_media_upload() $returndata["image"] = ["w" => $media["width"], "h" => $media["height"], "image_type" => $media["type"], - "preview" => $media["preview"]]; + "friendica_preview_url" => $media["preview"]]; Logger::log("Media uploaded: " . print_r($returndata, true), Logger::DEBUG); @@ -5685,7 +5684,6 @@ function api_friendica_notification($type) $notes = $xmlnotes; } - return api_format_data("notes", $type, ['note' => $notes]); } diff --git a/tests/include/ApiTest.php b/tests/include/ApiTest.php index e4e654f464..270f66aa53 100644 --- a/tests/include/ApiTest.php +++ b/tests/include/ApiTest.php @@ -1249,6 +1249,7 @@ class ApiTest extends DatabaseTest $this->assertEquals('image/png', $result['media']['image']['image_type']); $this->assertEquals(1, $result['media']['image']['w']); $this->assertEquals(1, $result['media']['image']['h']); + $this->assertNotEmpty($result['media']['image']['friendica_preview_url']); } /** -- 2.39.5