io io io io io io io
io ho questo dannatissimo problema -.-
e cavolo ci sto sbattendo la testa da tutto il giorno
e solo ora ho capito che è dovuto al .net -.-
vabbeh cmq io posto il codice, tanto presumo fossero uguali dato che mi da lo stesso e identico problema -.-
codice:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="true" %>
<%@ Import Namespace="System.Drawing"%>
<%@ Import Namespace="System.Drawing.Imaging"%>
<SCRIPT RUNAT="SERVER">
Sub Page_Load()
Dim immagine as String = Server.MapPath(Request("img"))
Dim bmp as System.Drawing.Bitmap = CType(System.Drawing.Image.FromFile(immagine), System.Drawing.Bitmap)
Dim dimMax as Integer = 0
Dim width as Integer = 0
Dim height as Integer = 0
try
if not Request.QueryString("dimMax") is Nothing Then
if bmp.Width = bmp.Height then
height = Int32.Parse(Request.QueryString("dimMax"))
end if
if bmp.Width > bmp.Height then
height = Int32.Parse(Request.QueryString("dimMax"))
end if
if bmp.Width < bmp.Height then
width = Int32.Parse(Request.QueryString("dimMax"))
end if
End if
' ricava dimensioni dalla richiesta
if not Request.QueryString("width") is Nothing Then
width = Int32.Parse(Request.QueryString("width"))
End if
if not Request.QueryString("height") is Nothing Then
height = Int32.Parse(Request.QueryString("height"))
End if
catch ex as Exception
End Try
' ridimensiona l'immagine se specificato
if Not System.Io.File.Exists(immagine) then
immagine = Server.MapPath("/public/liveShow/102.jpg")
end if
call ImgRedim(immagine, width, height)
' fermo il resto della risposta
Response.End()
End Sub
' Funzione di redim
Public Sub ImgRedim(immagine as String, width as Integer, height as Integer)
Dim bmp as System.Drawing.Bitmap = CType(System.Drawing.Image.FromFile(immagine), System.Drawing.Bitmap)
' c'è da ridimensionare?
if width>0 or height>0 then
' se è specificata solo la larghezza, calcola l'altezza
if height = 0 Then
height = Convert.ToInt32(width / bmp.Width * bmp.Height)
End if
' (e viceversa)
if width = 0 Then
width = Convert.ToInt32(height / bmp.Height * bmp.Width)
End if
' creo la Thumbnail con i parametri impostati
Dim miniaturabmp as New System.Drawing.Bitmap(bmp, width, height)
' salvo sullo stream di output
if immagine.EndsWith(".jpg") Then
miniaturabmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
else
miniaturabmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif)
end if
' pulizia
miniaturabmp.Dispose()
else
' salvo sullo stream di output
if immagine.EndsWith(".jpg") Then
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
else
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif)
end if
end if
' pulizia finale
bmp.Dispose()
End Sub
</SCRIPT>
e speriamo che qualche anima pia sappia risolvere O.o
'azzie