zoukankan
html css js c++ java
ASP.Net之瞒天过海
using
System;
using
System.Web;
using
System.Drawing;
using
System.Drawing.Imaging;
using
System.Net;
using
System.IO;
namespace
Goodspeed.test.httphandle
{
public
class
myjpg : IHttpHandler
{
public
myjpg()
{ }
public
void
ProcessRequest(HttpContext Context)
{
HttpResponse Response
=
Context.Response;
HttpRequest Request
=
Context.Request;
string
Url
=
Request.Url.ToString();
//
Url = "
http://www.allinone.net.cn/office/photo/pic/20040714/
" + Url.Substring(Url.LastIndexOf("/") + 1);
Url
=
"
http://img1.qq.com/news/20040721/490452.jpg
"
;
Response.ContentType
=
"
image/JPEG
"
;
WebClient wc
=
new
WebClient();
Stream resStream
=
wc.OpenRead(Url);
Image originalimage
=
Image.FromStream(resStream);
//
获取图像
方法二
#region
方法二
//
byte[] myDataBuffer = wc.DownloadData(Url);
//
Response.BinaryWrite(myDataBuffer);
#endregion
水印
#region
水印
Image newImage
=
Image.FromFile(
"
c:\watermark1.gif
"
);
//
水印
using
(Graphics g
=
Graphics.FromImage(originalimage))
{
Point ulCorner
=
new
Point(originalimage.Width
-
newImage.Width
-
5
, originalimage.Height
-
newImage.Height
-
5
);
//
水印的位置
g.DrawImage(newImage, ulCorner);
g.Dispose();
}
#endregion
originalimage.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.End();
originalimage.Dispose();
wc.Dispose();
}
public
bool
IsReusable
{
get
{
return
true
; }
}
}
}
查看全文
相关阅读:
Codeforces Round #375 (Div. 2) A. The New Year: Meeting Friends 水题
Codeforces Round #372 (Div. 1) A. Plus and Square Root 数学题
Codeforces Round #371 (Div. 1) C. Sonya and Problem Wihtout a Legend 贪心
Codeforces Round #371 (Div. 1) D. Animals and Puzzle 二维倍增
BZOJ 4706: B君的多边形 找规律
HDU 5909 Tree Cutting 动态规划 快速沃尔什变换
Codeforces Round #284 (Div. 1) A. Crazy Town 计算几何
HDU 5908 Abelian Period 暴力
HDU 5907 Find Q dp
Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D. Generating Sets 贪心
原文地址:https://www.cnblogs.com/goodspeed/p/25564.html
最新文章
Oracle比较2个表内容
ARM、X86/Atom、MIPS、PowerPC
BusinessUnit, User, Role 中常用的APIs
python Genarator函数
从零开始学C++之模板(三):缺省模板参数(借助标准模板容器实现Stack模板)、成员模板、关键字typename
面试题14:反转链表
【deep learning学习笔记】注释yusugomori的DA代码 --- dA.h
【deep learning学习笔记】注释yusugomori的DA代码 --- dA.cpp --模型准备
Apache URL重写的配置 及其 apache500错误
IEEEXtreme Practice Community Xtreme9.0
热门文章
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) E. Goods transportation 动态规划
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) D. Dense Subsequence 暴力
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) C. Ray Tracing 数学
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort 暴力
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar 水题
Codeforces Round #375 (Div. 2) F. st-Spanning Tree 生成树
Codeforces Round #375 (Div. 2) E. One-Way Reform 欧拉路径
Codeforces Round #375 (Div. 2) D. Lakes in Berland 贪心
Codeforces Round #375 (Div. 2) C. Polycarp at the Radio 贪心
Codeforces Round #375 (Div. 2) B. Text Document Analysis 模拟
Copyright © 2011-2022 走看看