Arjuna Aircraft Ident.: F-MBSD | Bon, ben en fait c'est plus simple, c'est au moment de la sauvegarde qu'on indique le format
Code :
- using System;
- using System.Drawing;
- using System.Drawing.Imaging;
- using System.Drawing.Drawing2D;
- using System.IO;
- using System.Data;
- namespace bci
- {
- /// <summary>
- /// Summary description for showPict.
- /// </summary>
- public class showPict : System.Web.UI.Page
- {
- public bool ThumbnailCallback()
- {
- return false;
- }
- private void Page_Load(object sender, System.EventArgs e)
- {
- string displayType = ((string) Request.QueryString["displayType"]);
- MemoryStream memStream = new MemoryStream();
- Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
- Image ori = Image.FromFile(Server.MapPath("medias/gnxPictures" ) + "\\flcl.jpg" );
- if (displayType == "thumbnail" )
- {
- Image thb;
- thb = ori.GetThumbnailImage(100, 70, myCallback, IntPtr.Zero);
- thb.Save(memStream, ImageFormat.Jpeg);
- thb.Dispose();
- }
- else
- {
- ori.Save(memStream, ImageFormat.Jpeg);
- }
- ori.Dispose();
- Response.Clear();
- Response.ContentType="image/jpeg";
- memStream.WriteTo(Response.OutputStream);
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }
|
|