Azure从blob中提取文件图标 [英] Azure extract the file icon from blob
问题描述
我再次提出问题..
我想从存储在azure blob存储中的文件中提取图标。
行动:
Once again I'm here with a question..
I want to extract the icon from a file that is stored in azure blob storage.
Action:
public FileResult GetUploadedFileIcon(string blobname)
{
string SASURI = GetUploadedFileIconSASURL(blobname);
Icon stream = System.Drawing.Icon.ExtractAssociatedIcon(SASURI);
Bitmap pngIcon = stream.ToBitmap();
MemoryStream ms = new MemoryStream();
pngIcon.Save(ms, ImageFormat.Png);
ms.Position = 0;
return new FileStreamResult(ms, "image/png");
}
查看:
View:
<img src="@Url.Action("GetUploadedFileIcon", "Home", new { blobname = file.BlobName })" />
问题:
它告诉我图标流为空。 SASURI没有任何问题。我尝试完全删除它并使用公共容器,但这没有帮助。我也尝试从本地存储的文件中获取图标,如下所示:
The problem:
It's telling me icon stream is null. Nothing is wrong with the SASURI. I tried removing it completely and go with public container but that did not help. I also tried getting the icon from a locally stored file, like this:
Icon stream = System.Drawing.Icon.ExtractAssociatedIcon(@"C:\WINDOWS\system32\notepad.exe");
这样有用..
所有blob的内容类型都是正确的,textfiles是text / plain等。
当我尝试从blob中提取图标时,为什么我的图标会显示空值?
我一如既往地感谢所有帮助!
谢谢
And that worked..
The content type for all the blobs are correct, textfiles are text/plain etc.
Why am i getting null value on my icon when I try to extract the icon from a blob?
And as always i appreciate all the help I can get!!
Thanks
推荐答案
这篇关于Azure从blob中提取文件图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!