Ho trovato in rete questo script che processa al volo un'immagine tagliandola e ridimensionandola per creare un quadrato
l'unico problema è che se la uso su un'immagine ad es 1.jpg quest'ultima non riesco a cancellarla manualmente perchè resta bloccata anche se il browser viene chiuso...in pratica lo script sembra continuare ad operare anche quando non serve.
codice:<%@ Page Language="VB"%> <%@ import Namespace="System.Drawing"%> <%@ import Namespace="System.Drawing.Imaging"%> <%@ import Namespace="System.Text.RegularExpressions"%> <% dim strFilename as string dim i as System.Drawing.Image dim b as System.Drawing.bitmap dim g as graphics If Left(request.QueryString("img"),4) = "http" then 'Response.Write("case1 ") strFilename=server.mappath(right(request.QueryString("img"),len(request.QueryString("img"))-len(Request.ServerVariables("SERVER_NAME"))-7)) else 'Response.Write("case2 ") strFilename = server.mappath(request.QueryString("img")) end if i = System.Drawing.Image.FromFile(strFilename) b = New system.drawing.bitmap(request.QueryString("opx"), request.QueryString("opx"), pixelformat.format24bpprgb) g = graphics.fromimage(b) g.InterpolationMode = 2 g.SmoothingMode = 4 g.PixelOffsetMode = 4 g.CompositingQuality = 4 ’ scale and translate the image Dim NewLar, NewAlt, SrcX, SrcY If i.height>i.width then NewLar = i.width NewAlt = i.width SrcX=0 SrcY = (((i.height*request.QueryString("opx"))/i.width)-request.QueryString("opx"))/2 else NewLar = i.height NewAlt = i.height SrcY = 0 SrcX = (((i.width*request.QueryString("opx"))/i.height)-request.QueryString("opx"))/2 end if g.drawimage(i,New rectangle(0,0,request.QueryString("opx"),request.QueryString("opx")), New rectangle(SrcX,SrcY,NewLar,NewAlt), GraphicsUnit.Pixel) 'Response.Write(NewLar & " " & NewAlt & " " & SrcX & " " & SrcY) response.contenttype="image/jpeg" b.save(response.outputstream, imageformat.jpeg) b.dispose() %>

Rispondi quotando
va bene, in attesa della risposta...
...se volessi invece creare dei rettangoli invece di fare solo quadrati?
