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);//获取图像


                
    方法二

                
    水印

                originalimage.Save(Response.OutputStream, ImageFormat.Jpeg);
                Response.End();
                originalimage.Dispose();
                wc.Dispose();
            }


            
    public bool IsReusable
            
    {
                
    get return true; }

            }


        }

    }

  • 相关阅读:
    通过securecrt跳板机登录linux服务器
    python2.x提示这个错误:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position
    使用python requests库写接口自动化测试--记录学习过程中遇到的坑(1)
    linux 中文乱码解决
    工作中常用到的命令
    LR学习文档整理
    Django入门示例之被解放的姜戈——02 庄园疑云(数据库及模型)
    Django入门示例之被解放的姜戈——01 初试天涯(安装及启动)
    格式化字符串format函数
    Python之print 格式化输出
  • 原文地址:https://www.cnblogs.com/goodspeed/p/25564.html
Copyright © 2011-2022 走看看