Best Practices Laravel RESTful

I am building a RESTful application with Laravel 4.2 using resource controllers as described here: https://scotch.io/tutorials/simple-laravel-crud-with-resource-controllers

The application is an online publishing platform. One part of the application allows customers to upload images and crop images for different publications. Each image can be marked with a title, artist, description.

Typically, a RESTful GET-index request URL will look like this. HTTP GET: example.com/image/

Each image will be uploaded with that URL. HTTP GET: example.com/image/{id}

Image number 3 will be deleted using HTTP DELETE for a URL like this. HTTP DELETE: example.com/image/3

However, my RESTful dilemma arises because each image must be stored in predetermined sizes. Thus, the image resource will be divided by the title, artist and description and will have representations that must be extracted in four different sizes: Original, 1024x768, 640x480, 320x240

The expected demand is about 80,000 images per year, resulting in 320,000 individual image files (original + 3 crops each).

That's where I am looking for the "best experience" ...

What should my Image Model look like to allow clients to access the endpoint to easily retrieve each cropped image?

What would be a good way to deal with the general nature of the title, artist and description?

URL-, №3 1024x768: : example.com/image/??? 1024x768: example.com/image/???

URL-, Image # 3: HTTP DELETE: example.com/image/???

, !

+4
4

, - Image; , Thumbnail? , URL :

Laravel : http://laravel.com/docs/4.2/controllers#restful-resource-controllers ( " " ).

, , ( ), Image - Image Thumbnail Image. - :

Image::deleting(function($image)
{
    Thumbnail::where('image_id', '=', $image->id)->delete();
});
+4

, Laravel Restful API, URL- Restful API .

.

+6

, "" .

OASIS Open Data Protocol (OData) 4.0

. http://www.odata.org/getting-started/basic-tutorial

0

Source: https://habr.com/ru/post/1569567/


All Articles