0
我試圖從圖像Azure的Blob存儲轉換爲Base64:將圖像從azure blob存儲轉換爲Base64?
private static string FromAzureToBase64(string azureUri)
{
Uri blobUri = new Uri(azureUri);
CloudBlockBlob blob = new CloudBlockBlob(blobUri, StorageAccount.Credentials);
byte[] arr = new byte[blob.Properties.Length];
blob.DownloadToByteArray(arr, 0);
var azureBase64 = Convert.ToBase64String(arr);
return azureBase64;
}
與arr
參數的問題是,我應該定義它的長度,但blob.Properties.Length
值爲-1,但是在圖像上存在Azure的,但幾乎所有的屬性null或不確定: