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 AddJpegCopyrigh tHttpHandler : IHttpHandler
{
const string COPYRIGHT_NOTIC E = " a copyright notice";
private SolidBrush brush = new SolidBrush(Colo r.Gray);
public AddJpegCopyrigh tHttpHandler()
{
}
#region Implementation of IHttpHandler
public void ProcessRequest( System.Web.Http Context context)
{
string filePath = context.Request .MapPath(contex t.Request.FileP ath);
PhotoGaleryPrin cipal user = System.Web.Http Context.Current .User as
PhotoGaleryPrin cipal;
bool isPrivate = filePath.IndexO f("\\PrivateGal ery\\") != -1;
if( (user == null && isPrivate) || (user != null &&
!user.AlowPriva teAccess && isPrivate) )
{
throw new System.Security .SecurityExcept ion("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(filePa th);
if( photo.Width > 200 && photo.Height > 200 )
{
Graphics g = Graphics.FromIm age(photo);
Font font = new Font("verdana", photo.Height / 100);
SizeF size = g.MeasureString (COPYRIGHT_NOTI CE, font);
g.DrawString(CO PYRIGHT_NOTICE, font, brush, photo.Width -
size.Width - 10, photo.Height - size.Height * 1.2F);
g.Dispose();
}
context.Respons e.ContentType = "image/jpeg";
photo.Save(cont ext.Response.Ou tputStream, ImageFormat.Jpe g);
}
public bool IsReusable
{
get
{
return true;
}
}
#endregion
}
hope this helps
_______________ _____
www.bloomfield.as.ro