Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/06/2008, 03:03
tammander
 
Fecha de Ingreso: enero-2006
Ubicación: Torroles (Costa der Só)
Mensajes: 1.017
Antigüedad: 19 años, 3 meses
Puntos: 7
Respuesta: :: Ajustar tamaño de imagen temporalmente ::

ASP por si sola no puede crear thumbs de otras imágenes. Tienes que utilizar componentes de terceros. Si te basta con redimensionar una imagen existente, esta función puede que te sirva:

Código:
function ImageResize(intCurrentWidth, intCurrentHeight, intDesiredWidth, intDesiredHeight)
   dim TargetRatio
   dim CurrentRatio
   dim strResize
   dim op
   
      TargetRatio = intDesiredWidth / intDesiredHeight
      CurrentRatio = intCurrentWidth / intCurrentHeight
      if CurrentRatio > TargetRatio then  ' Lo basamos en el alto
         op = int((intCurrentHeight * intDesiredWidth) / intCurrentWidth)
         strResize = "width=""" & intDesiredWidth & """ height=""" & op & """"
      else
         ' Lo basamos en al ancho
         op = int((intCurrentWidth * intDesiredHeight) / intCurrentHeight)
         strResize = "width=""" & op & """ height=""" & intDesiredHeight & """" 
      end if

   ImageResize = strResize
end Function
Lo único que tienes que averiguar es el tamaño de la imagen. Hace algún tiempo usaba esta clase para averiguar su tamaño:


--- NOTA: La clase la pego en otro post, ya que excede el tamaño máximo ---


Su uso:

Dim oImg
set oImg = new clsImage

' Cargamos la imagen
oImg.Read("images/mi_imagen.jpg")

' leemos su tamaño
wi = oImg.Width()
he = oImg.Height()

' redimensionamos
txtSize = ImageResize(wi, he, 80, 80)

' lo dibujamos
<img src="images/mi_imagen.jpg" <%=txtSize%> />



un saludo
__________________
"Tus pecados son el estiércol sobre el que florecerán las flores de tus virtudes" - Gerald Messadié -