Saving Base64 String as image to Azure Blob Storage
Recently I started working on a API which supports mobile backend. I got the following requirement 1. When user uploads a image to their profile API will get the base64 string of the image 2. When viewing the User profile to increase the performance of service calls have to send an image URL rather base64 string Solution : Save the base 64 string in the azure storage & save it in DB
public class AzureBlogService
{
private static string _connectionString = "DefaultEndpointsProtocol=https;AccountName=****;AccountKey=****";
public static string UploadImage(string imageData, ImageType imageType, int cardId)
{
string filename = GetFileName(imageType, cardId);
CloudBlobContainer container = GetContainer("userimages");
byte[] imageBytes = Convert.FromBase64String(imageData);
CloudBlockBlob blob = container.GetBlockBlobReference(filename);
blob.Properties.Cont...