Web/FileImage.aspx.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;

namespace Maticsoft.Web
{
    public partial class FileImage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int width = 0, height = 0; string filepath = "";
            if (Request.QueryString["width"] != null && Request.QueryString["width"] != "")
            {
                width = Convert.ToInt32(Request.QueryString["width"].ToString());
            }
            if (Request.QueryString["height"] != null && Request.QueryString["height"] != "")
            {
                height = Convert.ToInt32(Request.QueryString["height"].ToString());
            }
            if (Request.QueryString["path"] != null && Request.QueryString["path"] != "")
            {
                filepath = Request.QueryString["path"].ToString();
            }
            // Response.Write(width+"---"+height+"---"+filepath);
            CreateImageOutput(width, height, Server.MapPath(filepath));
        }

        /// <summary>  

        /// 根据路径读取文件,支持远程文件,本地文件  

        /// </summary>   
        /// <param name="path"></param>   
        /// <returns></returns>   
        private System.Drawing.Image GetImage(string path)
        {
            if (path.StartsWith("http"))
            {
                System.Net.WebRequest request = System.Net.WebRequest.Create(path);
                request.Timeout = 10000;
                System.Net.HttpWebResponse httpresponse = (System.Net.HttpWebResponse)request.GetResponse();
                Stream s = httpresponse.GetResponseStream();

                return System.Drawing.Image.FromStream(s);
            }
            else
            {
                return System.Drawing.Image.FromFile(path);
            }
        }
后面还有 103 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。