ciao ragazzi! sono su server aruba ed ho un probleme con il seguente script che uso per creare delle miniature delle immagini (thumbs):
dopo un po' che lo uso mi dà l'errore Out of Memory...ho chiesto ad arba ma mi dice che è causato da un loop o qlc di simile...mi dite x favore se c'è qlc errore???codice:<%@ Page Language="C#" %> <%@ import Namespace="System.Drawing" %> <%@ import Namespace="System.Drawing.Imaging" %> <%@ import Namespace="System.Text.RegularExpressions" %> <%@ import Namespace="System.IO"%> <script runat="server"> int MaxWidth = 100; // Larghezza massima dopo il quale l'immagine viene ridimensionata int MaxHeight = 100; // Altezza massima dopo il quale l'immagine viene ridimensionata System.Drawing.Image oldImage, newImage; void Page_Load(Object sender, EventArgs e) { if ( Request.QueryString["FileName"] != null ) { string strFileName = Convert.ToString(Request.QueryString["FileName"]); if ( strFileName != "" ) { try { oldImage = System.Drawing.Image.FromFile( Server.MapPath(strFileName) ); // Immagine troppo grande, visualizzo la miniatura newImage = oldImage.GetThumbnailImage(100, (oldImage.Height*100/oldImage.Width), null, IntPtr.Zero); Response.ContentType = "image/jpeg"; newImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); Environment.CurrentDirectory=AppDomain.CurrentDomain.BaseDirectory; oldImage.Dispose(); newImage.Dispose(); oldImage = null; newImage = null; } catch (Exception ex) { Response.Write(ex.Message); } } } } </script>
grazie mille!!

Rispondi quotando
