Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/02/2005, 10:01
perrogrun
Invitado
 
Mensajes: n/a
Puntos:
Me respondo a mi mismo, aki está la solución

Código:
<script language="VB" runat="server" Debug="true">

  Sub Page_Load(Sender As Object, E As EventArgs)
	
        Dim originalimg, thumb As System.Drawing.Image
        Dim FileName As String
        Dim inp As New IntPtr()
        Dim width, height As Integer
        Dim rootpath As String

        rootpath = Server.MapPath("/") ' Get Root Application Folder

        FileName = Server.MapPath(Request.QueryString("FileName")) ' Root Folder + FileName
        Try
            originalimg = originalimg.FromFile(FileName) ' Fetch User Filename
        Catch
            originalimg = originalimg.FromFile(rootpath & "error.gif") ' Fetch error.gif
        End Try

        ' Get width using QueryString.
        If Request.QueryString("width") = Nothing Then
            width = originalimg.Width  ' Use original Width. 
        ElseIf Request.QueryString("width") = 0 Then  ' Assign default width of 100.
            width = 100
        Else
            width = Request.QueryString("width") ' Use User Specified width.
        End If

        ' Get height using QueryString.
        If Request.QueryString("height") = Nothing Then
            height = originalimg.Height ' Use original Height.
        ElseIf Request.QueryString("height") = 0 Then ' Assign default height of 100.
            height = 100
        Else
            height = Request.QueryString("height") ' Use User Specified height.
        End If

        thumb = originalimg.GetThumbnailImage(width, height, Nothing, inp)

        ' Sending Response JPEG type to the browser. 
       Response.ContentType = "image/jpeg"
	   Dim NombreArchivo as String
		NombreArchivo = "thumb_" & right(FileName,len(FileName) - instrrev(FileName,"\"))
		Dim imagenpequena as String
		imagenpequena = Server.MapPath("/") & "..\imagenes\pruebas\" & NombreArchivo
	   	thumb.Save(imagenpequena, System.Drawing.Imaging.ImageFormat.Jpeg) 'Change jpeg word 
		
        ' Disposing the objects.
        originalimg.Dispose()
        thumb.Dispose()

  End Sub
</script>
Espero que os sirva, por cierto para que no os de error el usuario asp.net tiene que tener permisos de escritura.

Saludos