WebZC10/Admin/handler/tupian.aspx.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Tc.Web.Admin.handler
{
    public partial class tupian : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string path = LibFile.rootpath;
                HttpPostedFile postfile = Request.Files["Filedata"];
                string res = "0";
                string filename = "";
                var sj = DateTime.Now.ToString("yyyyMM");
                if (!Directory.Exists(Server.MapPath(path + sj)))
                {
                    Directory.CreateDirectory(Server.MapPath(path + sj));
                }
                var viewwidth = "";
                var viewheight = "";
                try
                {
                    path = path + sj + "/";
                    FileInfo file = new FileInfo(postfile.FileName);
                    string ext = file.Extension;
                    Random rd = new Random();
                    var randomname = DateTime.Now.ToString("ddHHmmss") + rd.Next(100000, 200000);
                    filename = randomname + ext;
                    postfile.SaveAs(Server.MapPath(path + "y_" + filename));

                    ProcessImage p = new ProcessImage();

                    //0:创建缩略图失败,1:传入的文件格式错误,2:创建成功
                    int r = p.CreateThumbnail(postfile, Server.MapPath(path + filename));
                    if (r == 2)
                    {
                        string[] wh = Request.QueryString["wh"].GetString().Split(',');
                        var len = wh.Length;
                        if (len >= 2)
                        {
                            viewwidth = wh[0];
                            viewheight = wh[1];
                            for (int i = 0; i + 1 < len; i += 2)
                            {
                                if (wh[i].GetInt() > 0 && wh[i + 1].GetInt() > 0)
                                {
                                    r = p.CreateThumbnail(postfile, Server.MapPath(path + wh[i] + wh[i + 1] + "_" + filename), wh[i].GetInt(), wh[i + 1].GetInt(), true);
                                }
                            }
                        }
                    }
                    else
                    {
后面还有 28 行代码,购买后查看完整代码

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

AI 解读

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

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