mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-23 21:47:59 +01:00
31 lines
No EOL
911 B
PHP
31 lines
No EOL
911 B
PHP
<?php
|
|
|
|
namespace Poniverse\Ponyfm\Http\Controllers\Api\Web;
|
|
|
|
use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase;
|
|
use Poniverse\Ponyfm\Image;
|
|
use Cover;
|
|
use Illuminate\Support\Facades\Response;
|
|
|
|
class ImagesController extends ApiControllerBase
|
|
{
|
|
public function getOwned()
|
|
{
|
|
$query = Image::where('uploaded_by', \Auth::user()->id);
|
|
$images = [];
|
|
foreach ($query->get() as $image) {
|
|
$images[] = [
|
|
'id' => $image->id,
|
|
'urls' => [
|
|
'small' => $image->getUrl(Image::SMALL),
|
|
'normal' => $image->getUrl(Image::NORMAL),
|
|
'thumbnail' => $image->getUrl(Image::THUMBNAIL),
|
|
'original' => $image->getUrl(Image::ORIGINAL)
|
|
],
|
|
'filename' => $image->filename
|
|
];
|
|
}
|
|
|
|
return Response::json($images, 200);
|
|
}
|
|
} |