Ejemplo n.º 1
0
        public bool SaveImage(CloudBlobContainer container, string userId, UserImageTypes userImageType, string sourceHash, string suffix, Image image, ImageFormat format, string sourceFormat, out Uri uri)
        {
            uri = null;
            try
            {
                CloudBlockBlob blockBlob = container.GetBlockBlobReference(string.Format("{0}-{1}-{2}-{3}.{4}", userId.Replace('/', '-'), (int)userImageType, sourceHash, suffix, sourceFormat));
                blockBlob.UploadFromStream(ToStream(image, format));
                uri = blockBlob.Uri;
            }
            catch (Exception exception)
            {
                _logger.Error(exception, "Error when save on Azure");
                return false;
            }

            return true;
        }
Ejemplo n.º 2
0
 public static ImageUploadSettings GetSettings(UserImageTypes userImageType)
 {
     return _settings[userImageType];
 }