Ciao a tutti
devo ridimenzionare delle immagini e salvarle su un server con windows server 2003.
Ho provato sia con Image Resizer e sia con AspImage:
Image Resizer
'Resize delle immagini
Sub ResizeImage(PathOriginal, PathDestination, Width, Height)
dim xml, strImagerDLL, bData, FileName
strImagerDLL = "http://www.MIOSITO.com/cgi-bin/Imager.dll"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "POST", strImagerDLL & "?Image=" & PathOriginal & "&Width=" & Width & "&Height=" & Height, False
xml.Send()
bData = xml.ResponseBody
Set xml = nothing
dim oStream
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.type = 1
oStream.mode = 3
oStream.open
oStream.write bData
oStream.Position = 0
oStream.SaveToFile PathDestination
oStream.Close
Set oStream = Nothing
End Sub
Non esegue SaveToFile
AspImage
'Resize delle immagini
Sub ResizeImage(PathOriginal, PathDestination, Width, Height)
' Dimensiono le variabili
Dim myImg, w, h, maxw, maxh, myw, myh
' Creo l'oggetto
Set myImg = Server.CreateObject("AspImage.Image")
' Carico l'immagine originale (da ridimensionare)
myImg.LoadImage PathOriginal
' Faccio un po' di calcoli per individuare il rapporto da utilizzare nel processo di miniaturizzazione
myw = Width
myh = (myImg.MaxY *Cint(Width))/myImg.MaxX
' Utilizzo il metodo resizer specificando larghezza e altezza
myImg.ResizeR myw, myh
' Salviamo il tutto indicando il percorso fisico ed il nome del nuovo file
myImg.FileName = PathDestination
if myImg.SaveImage then
Response.Write "[img][/img]"
else
Response.Write "Si è verificato un errore!"
end if
' Faccio pulizia
Set myImg = nothing
End Sub
Non accade nulla quando esegue if myImg.SaveImage then
Ho provato a mettere dei response.write dopo SaveToFile e SaveImage, ma non vengono eseguiti.
QUALCUNO PUO' AIUTARMI? ALTRI PROGRAMMI CHE POSSSO USARE?![]()

Rispondi quotando