/** * @api {get} /images/{imageId} Get Image Info * @apiGroup Images * @apiDescription Get the stored metadata for an image. * <br/>If an image is anonymous the `userId` value will set to `null` unless a valid `sessionKey` * for the owner of the image is given. * @apiUse RequiresViewableImage * @apiSuccessExample {json} Success Response * { * "image": { * "annotation": null, * "batchId": null, * "createdAt": "2010-05-03T07:22:35+01:00", * "expiresAt": null, * "image": { * "createdAt": "2010-05-03T07:22:35+01:00", * "directory": "img", * "fileId": 1, * "filename": "4bdec00b43a39.jpg", * "height": 1040, * "optimized": null, * "size": 181, * "updatedAt": null, * "url": "http://img.ctrlv.in/img/4bdec00b43a39.jpg", * "width": 1920 * }, * "imageId": 1, * "isCropped": false, * "privacy": 0, * "thumbnail": { * "createdAt": null, * "directory": "thumb", * "fileId": 663542, * "filename": "4bdec00b43a39.jpg", * "height": null, * "optimized": false, * "size": null, * "updatedAt": null, * "url": "http://img.ctrlv.in/thumb/4bdec00b43a39.jpg", * "width": null * }, * "title": "It's improved since this I promise", * "updatedAt": null, * "url": "http://ctrlv.in/1", * "userId": null, * "views": 1238 * } * } * * @param Image $image * * @return Response */ public function show(Image $image) { $this->requireViewableModel($image); $imageArray = $image->toArray(); if ($imageArray['albumId']) { $imageArray['album'] = Album::find($imageArray['albumId']); } if ($imageArray['userId']) { $imageArray['user'] = User::find($imageArray['userId']); } return $this->response(['image' => $imageArray]); }
/** * Execute the console command. * * @return mixed * @throws Exception */ public function handle() { $album = Album::findOrFail($this->argument('albumId')); \Queue::connection('sync')->push(new MakeAlbumThumbnailJob($album)); }
/** * @api {delete} /albums/{albumId} Delete an Album * @apiGroup Albums * @apiDescription Delete a album. This does not delete the images that were in it. * @apiUse RequiresAuthentication * @apiUse GenericSuccessResponse * * @param Album $album * * @return Response * @throws HttpException */ public function destroy(Album $album) { $this->requireAuthentication($album->userId); return $this->response(['success' => $album->delete()]); }