我想将保存图片的代码做到接口类中,用流来实现,但在接口中为什么就没有
using System.Drawing;
这个引用呢,如果没有这个引用的话,我原来用的生成缩略图代码就用不了,请问各位,我该如何解决,在vs2003环境下,建类。
其中这个函数的部分代码如下:
try
{
oriImg = System.Drawing.Image.FromStream(sr);
width2=oriImg.Width;
height2=oriImg.Height;
newImg = oriImg.GetThumbnailImage(intFeThumbWidth, intFeThumbWidth * oriImg.Height/oriImg.Width,null,new System.IntPtr(0));
newImg.Save(Pathb,System.Drawing.Imaging.ImageFormat.Jpeg);//保存缩略图
result +=" 缩略图上传成功!";
}
catch(Exception e)
{
result +=" 缩略图上传失败!";
} 其中sr 为 PostedFile.InputStream
我编译类时,老提示
类型或命名空间名称“Drawing" 在类或命名空间“System"不存在(是否缺少程序集引用)
但我在开头引用了using System.Drawing 也不是不行的,如果不在类中就可以引用这个Drawing,为什么,请各位高手指教指教! 谢谢!
using System.Drawing;
这个引用呢,如果没有这个引用的话,我原来用的生成缩略图代码就用不了,请问各位,我该如何解决,在vs2003环境下,建类。
其中这个函数的部分代码如下:
try
{
oriImg = System.Drawing.Image.FromStream(sr);
width2=oriImg.Width;
height2=oriImg.Height;
newImg = oriImg.GetThumbnailImage(intFeThumbWidth, intFeThumbWidth * oriImg.Height/oriImg.Width,null,new System.IntPtr(0));
newImg.Save(Pathb,System.Drawing.Imaging.ImageFormat.Jpeg);//保存缩略图
result +=" 缩略图上传成功!";
}
catch(Exception e)
{
result +=" 缩略图上传失败!";
} 其中sr 为 PostedFile.InputStream
我编译类时,老提示
类型或命名空间名称“Drawing" 在类或命名空间“System"不存在(是否缺少程序集引用)
但我在开头引用了using System.Drawing 也不是不行的,如果不在类中就可以引用这个Drawing,为什么,请各位高手指教指教! 谢谢!
控制离开当前方法之前必须对输出参数 "height" 赋值
控制离开当前方法之前必须对输出参数 "width" 赋值
public static string UploadFiles(Stream sr,string filepath,string filepathb,string type_allow,int fhw,out int width,out int height,string filetype,int ContentLength)而函数 return 语句前 我加了
width=200
height=300还是有错,不过没加之前有两对这样的提示,加了之后就少了一对
这又是什么问题呢?