类型或命名空间名称' Imageformat'不存在

时间:2014-09-21 05:26:51

标签: image azure visual-studio-2013 asp.net-mvc-5

我正在编写一个MVC5互联网应用程序,我正在将图像上传到Azure blob存储。当用户上传图像时,我希望创建缩略图图像并将此图像保存到blob存储中。

我有图像的输入流,并将其用作我函数的Stream fileStream参数。

这是我目前的代码:

public void CreateImageThumbnailFromStream(Stream fileStream, string filename, int width, int height)
{
    System.Drawing.Image image = System.Drawing.Image.FromStream(fileStream);
    System.Drawing.Image thumbnailImage = image.GetThumbnailImage(width, height, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
    MemoryStream imageStream = new MemoryStream();
    thumbnailImage.Save(imageStream, System.Drawing.Imaging.Imageformat.Jpeg);
    if (imageStream.Length > 0)
    {
        string containerName = User.Identity.GetUserName();
        CloudBlobContainer blobContainer = _blobStorageService.GetCloudBlobContainer(containerName);
        CloudBlockBlob blob = blobContainer.GetBlockBlobReference(filename);
        blob.UploadFromStream(imageStream);
    }
}

我收到以下错误:

The type or namespace name 'Imageformat' does not exist in the namespace 'System.Drawing.Imaging' (are you missing an assembly reference?

在这行代码中:

thumbnailImage.Save(imageStream, System.Drawing.Imaging.Imageformat.Jpeg);

我引用了以下程序集:

System.Drawing (in System.Drawing.dll)

以下是MSDN类文档:

http://msdn.microsoft.com/en-us/library/system.drawing.imaging.imageformat(v=vs.110).aspx

我可以帮助我的代码吗?

提前致谢

1 个答案:

答案 0 :(得分:0)

'ImageFormat',而不是Imageformat,它区分大小写。

相关问题