Resize med AspJpeg
Jeg har dette script som skal resize uploadede billeder til 100 i breden. Upload virker men den resizer ikke billedet.Kan nogen se hvorfor?
<%
' Create an instance of AspUpload object
Set Upload = Server.CreateObject("Persits.Upload")
' Compute path to save uploaded files to
'Path = Server.MapPath(".")
Path = "d:\web\mitsite.dk\www\editor\assets\books"
' Capture uploaded file. Return the number of files uploaded
Count = Upload.Save(Path)
If Count = 0 Then
Response.Write "No images selected."
Response.End
Else
' Obtain File object representing uploaded file
Set File = Upload.Files(1)
' Is this a valid image file?
If File.ImageType <> "UNKNOWN" Then
' Create instance of AspJpeg object
Set jpeg = Server.CreateObject("Persits.Jpeg")
' Open uploaded file
jpeg.Open( File.Path )
' Resize image according to "scale" option.
' We cannot use Request.Form, so we use Upload.Form instead.
' New width
L = 100
' Resize, preserve aspect ratio
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth
SavePath = Path & File.ExtractFileName
' AspJpeg always generates thumbnails in JPEG format.
' If the original file was not a JPEG, append .JPG ext.
If UCase(Right(SavePath, 3)) <> "JPG" Then
SavePath = SavePath & ".jpg"
End If
jpeg.Save SavePath
End IF
End IF
%>