|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class addWaterMark : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAddWaterMark_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
byte[] imgbyte = FileUpload1.FileBytes;
//creating object of ImageHandler Class
ImageHandler imageHandler = new ImageHandler();
System.Drawing.Image imageWithWatermark = imageHandler.AddWatermarkText(imgbyte, txtWaterMarkText.Text);
if (imageWithWatermark != null)
{
//file name to save
string saveFileName = Guid.NewGuid().ToString() + ".jpg";
//saving image in current root location
imageWithWatermark.Save(Server.MapPath(saveFileName));
//displaying image file in a Image Control
Image1.ImageUrl = saveFileName;
imageWithWatermark.Dispose();
}
else
{
if (imageHandler.havException)
{
Response.Write(imageHandler.ExceptionMessage);
}
}
}
}
}
|
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.