Torna al Thread

<%@ WebHandler Language="C#" Class="Thumb" %> using System; using System.Web; using System.Drawing; using System.IO; public class Thumb : IHttpHandler { public bool ThumbnailCallback() { return false; } public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext context) { Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback); Bitmap myBitmap; Image myThumbnail; string filePath = Path.Combine(context.Server.MapPath("."), context.Request.QueryString["file"]); myBitmap = new Bitmap(filePath); myThumbnail = myBitmap.GetThumbnailImage(100, 100, myCallback, IntPtr.Zero); myThumbnail.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); myThumbnail.Dispose(); myBitmap.Dispose(); } }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5