2015-08-31 16:30:02 +02:00
|
|
|
<?php
|
|
|
|
|
2015-10-24 03:22:14 +02:00
|
|
|
namespace Poniverse\Ponyfm\Http\Controllers\Api\Web;
|
2015-08-31 16:30:02 +02:00
|
|
|
|
2015-10-24 03:22:14 +02:00
|
|
|
use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase;
|
|
|
|
use Poniverse\Ponyfm\Image;
|
2015-08-31 16:30:02 +02:00
|
|
|
use Cover;
|
|
|
|
use Illuminate\Support\Facades\Response;
|
|
|
|
|
2015-09-06 19:21:11 +02:00
|
|
|
class ImagesController extends ApiControllerBase
|
2015-08-31 16:30:02 +02:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|