ho risolto:
codice:
<html>
<head>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Page Language="VB" Debug="true" %>
<script language="VB" runat=server>
Function NewthumbSize(currentwidth, currentheight)
' Calculate the Size of the New image
dim x,y,h,w as Double
x=currentwidth
y=currentheight
'h=Request.QueryString("h")
'w=Request.QueryString("w")
h=120
w=120
if (x>y) then
x=w
y=(w*y)/x
else
x=(h*x)/y
y=h
end if
dim NewSize as New Size(x, y)
return NewSize
End Function
Sub Page_Load(Sender As Object, E As EventArgs)
dim objBMP as System.Drawing.Bitmap
dim objGraph as System.Drawing.Image
objBMP = New Bitmap(
"C:\Programmi\Apache Group\Apache\htdocs\image.JPG")
dim thumbSize as New size
thumbSize = NewthumbSize(objBMP.width,objBMP.height)
objGraph = objBMP.GetThumbnailImage(thumbsize.width,
thumbsize.height, Nothing, IntPtr.Zero)
objGraph.Save(Server.MapPath("image_t.JPG"),
ImageFormat.JPEG)
End Sub
</script>
</head>
<body Runat="server">
<asp:Image ID="objGraph" Src="image_t.JPG" Runat="server" />
</body>
</html>
ora mi stavo chiedendo come potevo utilizzare questo script richiamandolo più volte inviandogli come parametri larghezza e altezza dell'anteprima nome file d'origine e nome file destinato all'anteprima (forse con un form e quattro parametri passati col get?)