A
A
Alexey Lebedev2015-07-31 11:16:30
PHP
Alexey Lebedev, 2015-07-31 11:16:30

What is the best way to store an image?

Imagine a store where the user can pick up clothes and share with friends.
For definiteness, let there be an object consisting of 4 pictures:
- naked body
- T-shirt
- pants
- shoes I
consider 3 options:
1) take a naked body and overlay png images on the client.
Pluses:
- caching of parts of pictures.
- decrease in actions on the server
Cons:
- more requests
- more traffic.
2) when saving the image, save the image as jpg(png)
Pros:
- less traffic
- the ability to cache the entire object
Cons:
- saving takes longer
- if there is a save error, there will be no image at all
3) at the first request to the image, generate it and issue it from the cache:
Pros:
- less traffic
- the ability to cache the entire object
- saving is faster
Cons:
- views take longer
- higher load on the server.
This will be done on ASP.NET with ashx handlers. But the question is more about architecture.
What is the best way to implement this thing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Papin, 2015-08-07
@i_light

I see no reason to save the resulting image somewhere other than at the request of the client. To simply show it, it is enough to store a collection of links to PNG files (JPEG does not support transparency) and overlay them directly in the browser on top of each other, without reducing them into a single image.
Pros:
- images are cached
- no load on the server
- no load on the client
Cons:
- the picture is not displayed instantly, but all parts are loaded one by one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question