As Steven said.
Here is a piece of code I used to implement such a http handler. The
handler is adding some text to the image. You should remove the security
check...
public class AddJpegCopyrightHttpHandler : IHttpHandler
{
const string COPYRIGHT_NOTICE = "© a copyright notice";
private SolidBrush brush = new SolidBrush(Color.Gray);
public AddJpegCopyrightHttpHandler()
{
}
#region Implementation of IHttpHandler
public void ProcessRequest(System.Web.HttpContext context)
{
string filePath = context.Request.MapPath(context.Request.FilePath);
PhotoGaleryPrincipal user = System.Web.HttpContext.Current.User as
PhotoGaleryPrincipal;
bool isPrivate = filePath.IndexOf("\\PrivateGalery\\") != -1;
if( (user == null && isPrivate) || (user != null &&
!user.AlowPrivateAccess && isPrivate) )
{
throw new System.Security.SecurityException("The picture you
requested is in a private galery. You must be logged in and have access
to private galeries to access this picture.");
}
Bitmap photo = (Bitmap)Bitmap.FromFile(filePath);
if( photo.Width > 200 && photo.Height > 200 )
{
Graphics g = Graphics.FromImage(photo);
Font font = new Font("verdana", photo.Height / 100);
SizeF size = g.MeasureString(COPYRIGHT_NOTICE, font);
g.DrawString(COPYRIGHT_NOTICE, font, brush, photo.Width -
size.Width - 10, photo.Height - size.Height * 1.2F);
g.Dispose();
}
context.Response.ContentType = "image/jpeg";
photo.Save(context.Response.OutputStream, ImageFormat.Jpeg);
}
public bool IsReusable
{
get
{
return true;
}
}
#endregion
}
hope this helps
____________________
www.bloomfield.as.ro