Prefered way to upload image with Ember ( DataUri vs Image Data)

Hi, I start writing an app that needs to handle image upload. My architecture, is a rest PHP back-end and Ember for the front-end. This is the 3 solutions that i see to make this. But which one is the best ?

In brief,

  1. The first makes a data uri of the image in the frontend side and sends the string representing the image to the backend that saves it to database. Simple but maybe this is not optimized.

  2. The second also makes a data uri from the image but instead of saving it the string representing the image into the database, the backend reconstructs and saves it on the file system and saves the link into the database.

  3. The Third uses the standard way, uploads the image to the server and saves it on the file system.

Any advice?

Advice: consider the approaches in the context of your problem. It seems you already know the benefits and drawbacks of each of your solutions, so it’s now a matter of weighing them depending on your use case, of which we don’t know anything.

In particular, in typical uses an image is served much more times that it is uploaded, so it’s common to save it in a way that makes serving it efficient. So… ask yourself how do you serve it, and what you can prepare at upload time to optimize that.

Ok, i’ve read some tips on Data Uri vs Url inclusion. It’s seems that Data Uri needs more bandwidth than Url, but saves requests. On mobile, Data Uri is slowest than Url ( I found 6x slowest but it’s on android 4 and iOS 6, so not up to date). And Data Uri is not cached like Url, If we access cached Html page with Data Uri, then the browser need to compute the image each time.

The web site I develop is a portfolio with average quantity of images, and will not have lots of user at the same time. So i think i will go with the third technique.

Thank you for you answer.