|
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
namespace GetWebSiteThumb
{
public partial class _Default : System.Web.UI.Page
{
public DateTime begintime;
public DateTime stoptime;
protected void Page_Load(object sender, EventArgs e)
{
//todo
}
protected void Button1_Click(object sender, EventArgs e)
{
StartDuration();
//example as a IHTTPHandler
ImageBox.ImageUrl = "~/HandlerWSThumb.ashx?url=" + Server.UrlEncode(txtURL.Text).ToLower().ToString() + "&bw=" + txtBW.Text + "&bh=" + txtBH.Text + "&tw=" + txtTW.Text + "&th=" + txtTH.Text;
StopDuration();
}
protected void Button2_Click(object sender, EventArgs e)
{
StartDuration();
//example as a Class Method
Bitmap bmp = ClassWSThumb.GetWebSiteThumbnail(txtURL.Text, Int32.Parse(txtBW.Text), Int32.Parse(txtBH.Text), Int32.Parse(txtTW.Text), Int32.Parse(txtTH.Text));
bmp.Save(Server.MapPath("~") + "/thumbnail.bmp");
ImageBox.ImageUrl = "~/thumbnail.bmp";
StopDuration();
}
protected void StartDuration()
{
begintime = DateTime.Now;
}
protected void StopDuration()
{
stoptime = DateTime.Now;
TimeSpan duration = (stoptime - begintime);
lblTime.Text = duration.ToString();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.