From: Hank Grabowski Date: Mon, 12 Dec 2022 16:27:59 +0000 (-0500) Subject: Fix Friendica Photo GET API endpoint to work without explicit scale term X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=46607598f3bb81174d2e2b54a82ffe95bbcc779d;p=friendica.git Fix Friendica Photo GET API endpoint to work without explicit scale term --- diff --git a/src/Factory/Api/Friendica/Photo.php b/src/Factory/Api/Friendica/Photo.php index 2621a7830c..4053a17776 100644 --- a/src/Factory/Api/Friendica/Photo.php +++ b/src/Factory/Api/Friendica/Photo.php @@ -57,14 +57,14 @@ class Photo extends BaseFactory * @param string $type * @return Array */ - public function createFromId(string $photo_id, int $scale = null, int $uid, string $type = 'json', bool $with_posts = true): array + public function createFromId(string $photo_id, int $scale, int $uid, string $type = 'json', bool $with_posts = true): array { $fields = ['resource-id', 'created', 'edited', 'title', 'desc', 'album', 'filename','type', 'height', 'width', 'datasize', 'profile', 'allow_cid', 'deny_cid', 'allow_gid', 'deny_gid', 'backend-class', 'backend-ref', 'id', 'scale']; $condition = ['uid' => $uid, 'resource-id' => $photo_id]; - if (is_int($scale)) { + if ($scale >= 0) { $fields = array_merge(['data'], $fields); $condition['scale'] = $scale; diff --git a/src/Module/Api/Friendica/Photo.php b/src/Module/Api/Friendica/Photo.php index b4b6a39970..5b21d8e922 100644 --- a/src/Module/Api/Friendica/Photo.php +++ b/src/Module/Api/Friendica/Photo.php @@ -54,7 +54,7 @@ class Photo extends BaseApi throw new HTTPException\BadRequestException('No photo id.'); } - $scale = (!empty($request['scale']) ? intval($request['scale']) : false); + $scale = (!empty($request['scale']) ? intval($request['scale']) : -1); $photo_id = $request['photo_id']; // prepare json/xml output with data from database for the requested photo