• 大小: 111KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: C#
  • 标签: 在线拍照  

资源简介

很好的在线拍照功能 很好的在线拍照功能 很好的在线拍照功能

资源截图

代码片段和文件信息

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

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender EventArgs e)
    {
        if (Request.Form[“PHeight“] != null && Request.Form[“PWidth“] != null && Request.Form[“strBMP“] != null)
        {
            try
            {
                Response.Write(“PWidth:“ + Request.Form[“PWidth“].ToString() + “
“);
                Response.Write(“PHeight:“ + Request.Form[“PHeight“].ToString() + “
“);

                int height = int.Parse(Request.Form[“PHeight“].ToString());
                int width = int.Parse(Request.Form[“PWidth“].ToString());

                string strBmp = Request.Form[“strBMP“].ToString();
                Response.Write(strBmp + “
“);

                SaveBmp(BuildBitmap(width height strBmp));

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
    public System.Drawing.Bitmap BuildBitmap(int width int height string strBmp)
    {
        System.Drawing.Bitmap tmpBmp = new Bitmap(width height System.Drawing.Imaging.PixelFormat.Format32bppRgb);
        string[] StmpBmp = strBmp.Split(‘‘);
        int pos = 0;
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                tmpBmp.SetPixel(x y Color.FromArgb(int.Parse(StmpBmp[pos] System.Globalization.Numberstyles.HexNumber)));
                pos++;
            }
        }
        return tmpBmp;
    }
    public void SaveBmp(System.Drawing.Bitmap bmp)
    {
        string FileName = Server.MapPath(“image“) + “\\“ + System.Guid.NewGuid().ToString() + “.bmp“;
        bmp.Save(FileName System.Drawing.Imaging.ImageFormat.Bmp);
    }
    public string GetframeList()
    {
        string[] fileList = System.IO.Directory.GetFiles(Server.MapPath(“frames“));
        string frameList = “\r\n

vascript:SetPhotoframe(\“\“)‘ style=\“text-decoration: none;\“>无

“;
        string fileName = string.Empty;
        foreach (string item in fileList)
        {
            fileName = item.Substring(item.LastIndexOf(“\\“) + 1);
            frameList += “

vascript:SetPhotoframe(\“frames/“ + fileName + “\“)‘ >ames/“ + fileName + “\“ width=\“80\“ height=\“60\“ />

\r\n“;
        }
        frameList += “ript language=\“javascript\“ type=\“text/javascript\“>InitMoveParm(document.getElementById(\“div_List\“)1100“ + (fileList.Length + 1).ToString() + “37550);ript>“;
        return frameList;
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2003-10-20 13:30  PhotoOnline\App_Data

     文件        755  2008-10-07 15:53  PhotoOnline\CSS\myCss.css

     目录          0  2003-10-20 13:30  PhotoOnline\CSS

     文件       2639  2008-10-07 21:37  PhotoOnline\Default.aspx

     文件       2986  2008-10-07 21:24  PhotoOnline\Default.aspx.cs

     文件       1371  2008-09-27 09:20  PhotoOnline\frames\f1.gif

     文件       1567  2008-09-26 14:21  PhotoOnline\frames\f10.gif

     文件       1553  2008-09-27 09:18  PhotoOnline\frames\f11.gif

     文件       1657  2008-09-27 09:19  PhotoOnline\frames\f12.gif

     文件       1567  2008-09-26 14:21  PhotoOnline\frames\f13.gif

     文件       1553  2008-09-27 09:18  PhotoOnline\frames\f14.gif

     文件       1657  2008-09-27 09:19  PhotoOnline\frames\f15.gif

     文件       1371  2008-09-27 09:20  PhotoOnline\frames\f16.gif

     文件       1567  2008-09-26 14:21  PhotoOnline\frames\f2.gif

     文件       1553  2008-09-27 09:18  PhotoOnline\frames\f3.gif

     文件       1657  2008-09-27 09:19  PhotoOnline\frames\f4.gif

     文件       1567  2008-09-26 14:21  PhotoOnline\frames\f5.gif

     文件       1553  2008-09-27 09:18  PhotoOnline\frames\f6.gif

     文件       1657  2008-09-27 09:19  PhotoOnline\frames\f7.gif

     文件       1371  2008-09-27 09:20  PhotoOnline\frames\f8.gif

     文件       1371  2008-09-27 09:20  PhotoOnline\frames\f9.gif

     目录          0  2003-10-20 13:30  PhotoOnline\frames

     文件     126054  2003-10-20 13:50  PhotoOnline\image\f92725ae-fdd0-4733-bab9-dd2f71c7d1ed.bmp

    ..A.SH.     18432  2008-10-20 11:46  PhotoOnline\image\Thumbs.db

     目录          0  2003-10-20 13:50  PhotoOnline\image

     文件        160  2008-10-05 21:57  PhotoOnline\Init.xml

     文件        438  2008-10-07 20:44  PhotoOnline\JS\JsAndAs.js

     文件       4400  2008-10-07 13:56  PhotoOnline\JS\JSPage.js

     目录          0  2003-10-20 13:30  PhotoOnline\JS

     文件       4002  2008-10-07 20:57  PhotoOnline\OnlinePhoto.htm

............此处省略12个文件信息

评论

共有 条评论