-
asp.net 修改图片的分辨率,修改图片的长宽象素比例,修改图片的物理宽度大小
-
-
-
-
-
-
-
-
- public void update_picture(string fileFoldUrl, string fileName, string filePath, int _width, int _height)
- {
- byte[] zp = this.load_pictMemory(filePath);
-
- MemoryStream ms = new MemoryStream(zp);
-
- System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
-
- Bitmap btp = new Bitmap(img, _width, _height);
-
- DirectoryInfo dti = new DirectoryInfo(fileFoldUrl);
-
- FileInfo[] fis = dti.GetFiles();
-
- string fileUrl = fileFoldUrl + fileName;
-
- btp.Save(fileUrl);
- }
-
-
-
-
-
-
- public byte[] load_pictMemory(string filePath)
- {
- byte[] pictData = null;
-
- FileInfo fi = new FileInfo (filePath);
-
- if (fi.Exists)
- {
- pictData = new byte[fi.Length];
-
- FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite);
-
- BinaryReader br = new BinaryReader(fs);
-
- br.Read(pictData, 0, Convert.ToInt32(fi.Length));
-
- fs.Dispose();
- }
- else
- {
- HttpContext.Current.Response.Write("<script language='javascript'>alert('没有找到你所指定的图片')</script>");
- }
- return pictData;
- }
-
相关阅读:
day14 多态与抽象
day13 类的补充
day12 继承
第三周总结 类、对象、包
day11 细节记忆
Dapper使用
修改SQL Server 中数据库的Collation
Web API 输出文件缓存
Sql从邮件中提取国家代码
解决Nuget:https://api.nuget.org/v3/index.json 访问不了的问题
-
原文地址:https://www.cnblogs.com/jordan2009/p/1553627.html
Copyright © 2020-2023
润新知