我看同事使用JAVA调用AP使用imagemagick生成缩略图而且很清楚,在C#中怎么使用啊?
解决方案 »
- 下载文件时会有一个提示"打开"和"保存",如何获取到用户是否点击了"保存"
- 有个问题,问出来怕大家笑
- 用Microsoft Visual Studio 2005除了作网站,还能作什么,最好给出一个简单实用的小例子的代码
- JavaScript:心里总觉得不踏实
- 救命啊!网套用模板页打印问题的
- datagrid设置绑定主键问题!!!!!!
- 图片连接问题!
- 如何实现控件的动态控制??
- .net 技术问题(网站的下载与刷新)
- 那里有比较稳定的ASP.NET空间租用啊?
- 如何在GridView分页行里面增加实现当前第几页,总共几页
- 关于翻页广告如何通过绑定数据库改变所显示图片的问题(高分!!急!!在线等)
{
protected void Page_Load(object sender, EventArgs e)
{
Stream s = File.Open(Server.MapPath("~/")+ "/s_3.gif", FileMode.Open, FileAccess.Read, FileShare.None);
byte[] b = new byte[(int)s.Length];
s.Read(b, 0, (int)s.Length); Response.OutputStream.Write(b, 0, (int)s.Length);
s.Close(); } protected void Button1_Click1(object sender, EventArgs e)
{
if (File1.PostedFile.FileName != null)
{
string namestr = Path.GetFileName(File1.PostedFile.FileName);//提取文件名
File1.PostedFile.SaveAs(Server.MapPath(".") + @"\" + namestr);
Image2.Visible = true;
Image2.ImageUrl = namestr;
System.Drawing.Image image, aNewImage;
image = System.Drawing.Image.FromStream(File1.PostedFile.InputStream);
decimal width = image.Width;
decimal height = image.Height;
int newwidth, newheight;
if (width > height)
{
newwidth = 150;
newheight = (int)(height / width * 150);
}
else
{
newheight = 150;
newwidth = (int)(width / height * 150);
}
aNewImage = image.GetThumbnailImage(newwidth, newheight, null, IntPtr.Zero);
Bitmap output = new Bitmap(aNewImage);
Graphics g = Graphics.FromImage(output);
g.DrawString("LonoL", new Font("Courier New", 9), new SolidBrush(Color.Red), 60, 60);//写版权信息及文本格式及位置
output.Save(Server.MapPath("~/") + @"\s_" + namestr, System.Drawing.Imaging.ImageFormat.Jpeg);
Image1.Visible = true;
Image1.ImageUrl = "s_" + namestr;
}
else
{
Response.Write("B");
}
}
}
using System.Drawing.Imaging;
using System.IO;
需要被引用的