Salve a tutti,
sto imparando ASP.net, ma ho necessità urgente di fare utilizzare il watermark di un'immagine con un testo e salvare il tutto su disco.
Chi mi puo' aiutare?
Ecco lo script che uso :
Quando uso questo script, ottengo il seguente errore :codice:<script runat="server"> ' Insert page code here ' </script> <%@ Page Explicit="True" Language="VB" Debug="True" %> <%@ Import Namespace="system.drawing" %> <%@ Import Namespace="system.drawing.imaging" %> <%@ Import Namespace="system.drawing.drawing2d" %> <%@ Import Namespace="system.io" %> <script runat="server"> dim Filename, Filename1 as String dim Width, Height, shadowSize as Integer dim Bitmap as system.drawing.bitmap dim ImgFormat as ImageFormat dim Img as System.Drawing.Image Dim baseMap as Bitmap dim top, left as Integer sub CreateGraphic() Dim letterBrush as SolidBrush = new SolidBrush(Color.FromArgb(0, 159, 5, 5)) Dim shadowBrush as SolidBrush = new SolidBrush(Color.FromArgb(50, 0, 0, 0)) Dim fontTitle as Font = new Font("Arial", 20, FontStyle.Bold) Filename = "foto/" & Request.QueryString("filename") Filename = server.mappath(Filename) Filename1 = "foto/test01.jpg" Filename1 = server.mappath(Filename1) ImgFormat = ImageFormat.jpeg : response.contenttype="image/jpeg" ' Default=jpeg ' Img = system.drawing.image.FromFile(Filename) Width = Img.Width Height = Img.Height baseMap = new Bitmap(Width,Height) Dim myGraphic as Graphics = Graphics.FromImage(baseMap) with myGraphic .DrawImage(Img, 0,0, Width,Height) .SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias .DrawString("miotesto.com", fontTitle, shadowBrush, 5, 60) .DrawString("miotesto.com", fontTitle, letterBrush, 7, 62) end with Img.dispose() end sub </script> <% CreateGraphic baseMap.Save(Filename, ImageFormat.JPEG) baseMap.dispose() Img = Nothing response.end %>
Cosa puo' essere?codice:Errore generico in GDI+. Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack. Dettagli eccezione: System.Runtime.InteropServices.ExternalException: Errore generico in GDI+. Errore nel codice sorgente: Riga 45: <% Riga 46: CreateGraphic Riga 47: baseMap.Save(Filename, ImageFormat.JPEG) Riga 48: baseMap.dispose() Riga 49: Img = Nothing File sorgente: C:\Inetpub\wwwroot\mytestsyte\watermark.aspx Riga: 47 Analisi dello stack: [ExternalException (0x80004005): Errore generico in GDI+.] System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +579 System.Drawing.Image.Save(String filename, ImageFormat format) +59 ASP.watermark_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in C:\Inetpub\wwwroot\mytestsyte\watermark.aspx:47 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243 System.Web.UI.Page.ProcessRequestMain() +1929
HELP!!!!
![]()



Rispondi quotando