using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Drawing; using System.Drawing.Imaging; /// /// Summary description for OmaPildiHaldur /// public class OmaPildiHaldur : IHttpHandler { public OmaPildiHaldur() { // // TODO: Add constructor logic here // } #region IHttpHandler Members public bool IsReusable { get { throw new NotImplementedException(); } } public void ProcessRequest(HttpContext context) { Bitmap pilt = new Bitmap(context.Request.PhysicalPath); Graphics g = Graphics.FromImage(pilt); if (context.Request.PhysicalPath.EndsWith(".gif")) { g.DrawString(DateTime.Now.ToString(), new Font("Courier", 10), Brushes.Red, 10, 10); context.Response.ContentType = "image/gif"; pilt.Save(context.Response.OutputStream, ImageFormat.Gif); return; } g.DrawRectangle(Pens.Yellow, 10, 10, 10, 10); context.Response.ContentType = "image/jpeg"; pilt.Save(context.Response.OutputStream, ImageFormat.Jpeg); //gif-piltidele lisatakse vaatamise kellaaeg // throw new NotImplementedException(); } #endregion }