Skip to content

A self-hosted media server and file management system

feat: return list of images with metadata resource

aminnausin2cc3d49e3588
diff --git a/app/Http/Resources/ImageResource.php b/app/Http/Resources/ImageResource.php
index 5dd51de1..585cdf1c 100644
--- a/app/Http/Resources/ImageResource.php
+++ b/app/Http/Resources/ImageResource.php
@@ -14,7 +14,9 @@ class ImageResource extends JsonResource {
public function toArray(Request $request): array {
return [
'id' => $this->id,
- 'path' => "/storage/{$this->path}",
+ 'path' => asset("/storage/{$this->path}"),
+ 'type' => $this->image_type->value,
+ 'source' => $this->image_source->value,
'blur_hash' => $this->blur_hash,
];
}
diff --git a/app/Http/Resources/MetadataResource.php b/app/Http/Resources/MetadataResource.php
index 8c394e6d..298dcb73 100644
--- a/app/Http/Resources/MetadataResource.php
+++ b/app/Http/Resources/MetadataResource.php
@@ -26,6 +26,7 @@ class MetadataResource extends JsonResource {
'poster_url' => $this->poster_url,
'poster_image' => $this->primaryPoster ? new ImageResource($this->primaryPoster) : null,
+ 'images' => ImageResource::collection($this->images),
'duration' => $this->duration,
'mime_type' => $this->mime_type,
diff --git a/resources/js/contracts/media.ts b/resources/js/contracts/media.ts
index 9a4137b7..c66d1bd8 100644
--- a/resources/js/contracts/media.ts
+++ b/resources/js/contracts/media.ts
@@ -84,6 +84,7 @@ export interface MetadataResource {
poster_url?: string;
poster_image?: ImageResource;
+ images?: ImageResource[];
artist?: string;
album?: string;
@@ -169,6 +170,8 @@ export interface StoryboardResource {
export interface ImageResource {
id: number;
path: string;
+ type: string;
+ source: string;
blurHash?: string;
}