public BlobStorage(BlobSettings appSettings) { try { if (appSettings.ImageSize != null) ResizeLayer = new ResizeLayer(appSettings.ImageSize, ResizeMode.Min); UploadThumbnail = appSettings.UploadThumbnail; StorageAccountName = appSettings.StorageAccountName; StorageAccountAccessKey = appSettings.StorageAccountAccessKey; // Create a blob client and retrieve reference to images container BlobClient = StorageAccount.CreateCloudBlobClient(); Container = BlobClient.GetContainerReference(appSettings.ContainerName); // Create the "images" container if it doesn't already exist. if (Container.CreateIfNotExists()) { // Enable public access on the newly created "images" container Container.SetPermissions( new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); } } catch (Exception ex) { Debug.WriteLine(ex); } }
public BlobStorage(BlobSettings appSettings) { try { if (appSettings.ImageSize != null) { ResizeLayer = new ResizeLayer(appSettings.ImageSize, ResizeMode.Min); } UploadThumbnail = appSettings.UploadThumbnail; StorageAccountName = appSettings.StorageAccountName; StorageAccountAccessKey = appSettings.StorageAccountAccessKey; // Create a blob client and retrieve reference to images container BlobClient = StorageAccount.CreateCloudBlobClient(); Container = BlobClient.GetContainerReference(appSettings.ContainerName); // Create the "images" container if it doesn't already exist. if (Container.CreateIfNotExists()) { // Enable public access on the newly created "images" container Container.SetPermissions( new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); } } catch (Exception ex) { Debug.WriteLine(ex); } }