kuvia/app/Http/Resources/Image.php

32 lines
1 KiB
PHP
Raw Normal View History

2021-02-08 10:00:42 +00:00
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Image extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$d = [];
2021-02-08 11:38:00 +00:00
$d["id"] = $this->id;
2021-02-08 10:00:42 +00:00
$d["name"] = $this->name;
$d["description"] = $this->description;
$d["filename"] = $this->filename;
$d["size"] = $this->size;
$d["exit"] = ["DateTimeOriginal" => $this->DateTimeOriginal];
$d["url"] = [
"small" => url("/".$this->getGallery()->getTenant()->url."/".$this->getGallery()->url."/".$this->id."/file?size=small"),
"medium" => url("/".$this->getGallery()->getTenant()->url."/".$this->getGallery()->url."/".$this->id."/file?size=medium"),
"big" => url("/".$this->getGallery()->getTenant()->url."/".$this->getGallery()->url."/".$this->id."/file?size=big")
];
return $d;
}
}