Bueno la cosa está en que ante la necesidad de implementar una aplicación que redimensione una imagen y dado que no disponía en el lenguaje que estaba usando (PHP) de la librería de funciones necesarias para imágenes (el servidor no tiene instalada la biblioteca GD) me ví obligado a utilizar un script en .NET que redimensiona una imagen, aprovechando que el servidor es WINDOWS.
Lo malo es que la calidad deja mucho que desear:
Ejemplo de redimensión(se aprecia baja calidad):
http://www.deporterey.com/ShowImage....if&w=100&h=100 http://www.deporterey.com/ShowImage....if&w=200&h=200
Ejemplo de imagen real:
http://www.deporterey.com/public/feeds/labete666.gif
Este es el código:
Código PHP:
<%@ 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")
'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
'Add on the appropriate directory
imageUrl = "public/feeds/" & imageUrl
Dim fullSizeImg as System.Drawing.Image
fullSizeImg = System.Drawing.Image.FromFile(Server.MapPath(imageUrl))
'Do we need to create a thumbnail?
Response.ContentType = "image/gif"
If imageHeight > 0 and imageWidth > 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(imageWidth, imageHeight, _
dummyCallBack, IntPtr.Zero)
thumbNailImg.Save(Response.OutputStream, ImageFormat.Gif)
Else
fullSizeImg.Save(Response.OutputStream, ImageFormat.Gif)
End If
End Sub
</script>
No tengo mucha idea de .NET, pero como sé que en PHP todo depende de usar una función que meta los color en truecolor, por sí simplemente se trata de eso, por eso pregunto.
Salu2 ;)