2020-06-12 13:55:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
|
|
|
use App\Models\Album;
|
|
|
|
use App\Services\MediaMetadataService;
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group 5. Media information
|
|
|
|
*/
|
|
|
|
class AlbumThumbnailController extends Controller
|
|
|
|
{
|
|
|
|
private $mediaMetadataService;
|
|
|
|
|
|
|
|
public function __construct(MediaMetadataService $mediaMetadataService)
|
|
|
|
{
|
|
|
|
$this->mediaMetadataService = $mediaMetadataService;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get an album's thumbnail
|
|
|
|
*
|
2020-06-12 15:05:18 +00:00
|
|
|
* Get an album's thumbnail (a 48px-wide blurry version of the album's cover).
|
|
|
|
* Returns the full URL to the thumbnail or NULL if the album has no cover.
|
2020-06-12 13:55:45 +00:00
|
|
|
*
|
2020-09-12 15:01:48 +00:00
|
|
|
* @response ["thumbnailUrl", "https://localhost/img/covers/a146d01afb742b01f28ab8b556f9a75d_thumbnail.jpg"]
|
2020-06-12 13:55:45 +00:00
|
|
|
*/
|
|
|
|
public function get(Album $album): JsonResponse
|
|
|
|
{
|
|
|
|
return response()->json(['thumbnailUrl' => $this->mediaMetadataService->getAlbumThumbnailUrl($album)]);
|
|
|
|
}
|
|
|
|
}
|