I run a website that is hosted on Microsoft Azure and I'd like to store users' profile pictures. Which storage solution would be better ? I'm aware of a few ways to do so :

  • Store images as blobs in database (but I need to render it via a controller)
  • Store images as base64 in database (but I need to render it via a controller)
  • Store images on disk (in app_data ?) and store the file name in database

Maybe there are other ways. Please tell me what could be my best choices ?

  • 1
    This might depend on the number of pictures per user and their size/quality. Are we talking about low-res images used for user's avatars, or high quality photographs that users share with each other? – Bart van Ingen Schenau Sep 11 '15 at 13:16
  • @BartvanIngenSchenau I need to store something like 10 pictures max per user (big enough for a dating site but not necessarily high definition) and one picture avatar (one of the big pictures resized) – bob Sep 11 '15 at 13:24
  • Images are usually stored on disk. I don't know enough to give you an answer, but I'd figure that images are stored in an optimized format most of the time and transforming it to for example base64 and back again is an unnecessary roundtrip. – Erik Bergstedt Sep 11 '15 at 14:01
  • You may find Embedding Base64 Images useful (though that comes with a 'you can't cache this' penalty at the web level). – user40980 Sep 11 '15 at 18:57
  • What disk? The local disk is voilitile and the azure disk offering is basically an abstraction over blobs. – Nathan Cooper Sep 11 '15 at 19:03

Storing images is one of the classic use cases of Blob Storage. You can configure a Web Job to kick off each time an image is uploaded for any processing you may need to do (resize, generate a thumbnail, etc). You can also serve up the images right from blob storage - just store the image URL in your db. No need to serialize the images or have them pass through your application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.