Skip to content

Commit

Permalink
Update mobile apis, add blurhash
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Jan 19, 2021
1 parent 4415af1 commit cf40526
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiV1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,8 @@ public function mediaUpload(Request $request)

$resource = new Fractal\Resource\Item($media, new MediaTransformer());
$res = $this->fractal->createData($resource)->toArray();
$res['preview_url'] = url('/storage/no-preview.png');
$res['url'] = url('/storage/no-preview.png');
$res['preview_url'] = $media->url(). '?cb=1&_v=' . time();
$res['url'] = $media->url(). '?cb=1&_v=' . time();
return response()->json($res);
}

Expand Down
5 changes: 3 additions & 2 deletions app/Transformer/Api/MediaTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public function transform(Media $media)
return [
'id' => (string) $media->id,
'type' => $media->activityVerb(),
'url' => $media->url(),
'url' => $media->url() . '?cb=1&_v=' . time(),
'remote_url' => null,
'preview_url' => $media->thumbnailUrl(),
'preview_url' => $media->thumbnailUrl() . '?cb=1&_v=' . time(),
'text_url' => null,
'meta' => null,
'description' => $media->caption,
Expand All @@ -24,6 +24,7 @@ public function transform(Media $media)
'filter_name' => $media->filter_name,
'filter_class' => $media->version == 1 ? $media->filter_class : null,
'mime' => $media->mime,
'blurhash' => $media->blurhash
];
}
}

0 comments on commit cf40526

Please sign in to comment.