Ver Mensaje Individual
  #10 (permalink)  
Antiguo 24/06/2008, 18:34
yomesmo
 
Fecha de Ingreso: noviembre-2003
Ubicación: Madrid
Mensajes: 353
Antigüedad: 21 años, 5 meses
Puntos: 1
Respuesta: MoveFile me bloquea los ficheros

Estoy revisando (No estoy muy ducho en Net) y creo que lo tengo bien:

Código:
<%@ Page Language="VB" Debug="true"%>
<%@Import Namespace="System.Drawing.Imaging" %>
<script language="VB" runat="server">
  Function ThumbnailCallback() as Boolean
    Return False
  End Function


  Sub Page_Load(sender as Object, e as EventArgs)
  
    'Read in the image filename to create a thumbnail of
    Dim imageUrl as String = Request.QueryString("img")
	Dim Ruta as string ="c:/inetpub/wwwroot//www/imagenes/imagenes_web/clasificados/"

	imageUrl = Ruta+imageUrl
    
    'Read in the width and height
Dim imageHeight as Integer = Request.QueryString("h")
Dim imageWidth as Integer = Request.QueryString("w")

    'Make sure that the image URL doesn't contain any /'s or \'s
    'If imageUrl.IndexOf("/") >= 0 Or imageUrl.IndexOf("\") >= 0 then
      'We found a / or \
     ' Response.End()
    'End If
    
    Dim fullSizeImg as System.Drawing.Image
    fullSizeImg = System.Drawing.Image.FromFile(imageUrl)	
		 

				'Redimensionamos proporcionalmente
						Dim intNewWidth,intNewHeight
						if imageWidth >= imageHeight then
							intNewWidth = (imageHeight*fullSizeImg.Width/fullSizeImg.Height)
							intNewHeight = imageHeight
							
						else 
							intNewWidth = imageWidth
							intNewHeight = (imageWidth*fullSizeImg.Height/fullSizeImg.Width)
						end if	
						if intNewWidth > imageWidth then
							intNewWidth = imageWidth
							intNewHeight = (imageWidth*fullSizeImg.Height/fullSizeImg.Width)
						end if	
						if intNewHeight > imageHeight then
							intNewWidth = (imageHeight*fullSizeImg.Width/fullSizeImg.Height)
							intNewHeight = imageHeight
						end if			
				'Fin redimensionar
    


    'Do we need to create a thumbnail?
    Response.ContentType = "image/jpeg"
    If intNewHeight > 0 and intNewWidth > 0 then
      Dim dummyCallBack as System.Drawing.Image.GetThumbNailImageAbort
      dummyCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)

      Dim thumbNailImg as System.Drawing.Image
      thumbNailImg = fullSizeImg.GetThumbnailImage(intNewWidth, intNewHeight, dummyCallBack, IntPtr.Zero)

      'thumbNailImg.Save(Response.OutputStream, ImageFormat.Jpeg)
	  thumbNailImg.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) 
	  
	  thumbNailImg.Dispose()
    Else
      'fullSizeImg.Save(Response.OutputStream, ImageFormat.Jpeg)
	  fullSizeImg.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) 
	  fullSizeImg.Dispose()
	  
    End If
	
  End Sub
</script>
__________________
Lo menos frecuente en este mundo es vivir. La mayoría de la gente existe, eso es todo...