icebreaker-science / backend

The backend (Spring Boot) part of the icebreaker.science application
Apache License 2.0
2 stars 0 forks source link

Add image for wiki page/device #35

Closed chaoran-chen closed 3 years ago

chaoran-chen commented 4 years ago

When creating a device, it should be possible to add an image. Later, we would probably like to be able to have multiple images but for now, adding a single one is enough.

How should the API look like? The simplest way for us is, I think, to encode the image as base64 and send it as part of the POST /wiki request. But there are various other solutions, see, for example, https://stackoverflow.com/questions/33279153/rest-api-file-ie-images-processing-best-practices. What do you think is the best?

Please add some reasonable limits regarding the size (both resolution- and byte-wise (200KB?)) and document them well. There is no need for an image resizer. I think that it would be easier to do the resizing in the frontend.

Furthermore, where should we store the images? Since we are only building a small tool and don't really need to expect a gigantic amount of traffic, I think that keeping them in the PostgreSQL database would be the simplest approach, especially for later when we implement APIs to delete or to modify the entries.

michael-kamel commented 4 years ago

Just keep them in the file system. If we want to have some flexibility we can put a reverse proxy in front and redirect the image requests internally. I think most web servers implement a mechanism for this, for example for nginx.

@chaoran-chen What do you think of this approach?

chaoran-chen commented 4 years ago

okay, that's fine for me :)