![]() |
AspJpeg
Hello!
I am making a upload script for my images. I want the script to resize the images automaticly. The server supports AspJpeg but i don't have AspUpload. Can anyone help me to implement the AspJpeg code into my upload code? AspJpeg CODE. '--------------------------------------------------------------------------- ----------------------- ' create instance of AspJpeg object Set jpeg = Server.CreateObject("Persits.Jpeg") ' open uploaded file jpeg.Open( File.Path ) ' resize image accoring to "scale" option. ' notice that we cannot use Request.Form, so we use Upload.Form instead. jpeg.Width = jpeg.OriginalWidth * Upload.Form("scale") / 100 jpeg.Height = jpeg.OriginalHeight * Upload.Form("scale") / 100 SavePath = Server.MapPath("/bilde/") & File.ExtractFileName ' AspJpeg always generates JPEG thumbnails regardless of original format. ' If the original file was not a JPEG, append .JPG extension. If UCase(Right(SavePath, 3)) <> "JPG" Then SavePath = SavePath & ".jpg" End If jpeg.Save SavePath '--------------------------------------------------------------------------- ---------------------- MY UPLOAD CODE '--------------------------------------------------------------------------- ---------------- if Request.QueryString("action") = "upload" then Server.ScriptTimeout = 1200 Response.Expires = 0 Response.Buffer = TRUE Response.Clear Dim UploadRequest Set UploadRequest = CreateObject("Scripting.Dictionary") ByteCount = Request.TotalBytes if ByteCount > Application("MaxFileSize2Upload") then Response.Redirect "./select_image.asp?error=05" end if RequestBin = Request.BinaryRead(byteCount) BuildUploadRequest RequestBin Dim aux, aux1 Dim ImageCateg, ContentType, FilePathName, FileName, Value ImageCateg = Unescape(UploadRequest.Item("inpcatid").Item("Valu e")) 'Image Folder on error resume next ContentType = UploadRequest.Item("inpFile").Item("ContentType") FILEFLAG = err.number on error goto 0 if FILEFLAG = 0 then ContentType = UploadRequest.Item("inpFile").Item("ContentType") FilePathName = UploadRequest.Item("inpFile").Item("FileName") FileName = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\")) Value = UploadRequest.Item("inpFile").Item("Value") else FileName = "" end if Dim objFSO2 Dim objUploadFile if FileName<>"" then on error resume next Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject") Set objUploadFile = objFSO2.CreateTextFile(ImageCateg&"\"&FileName) objUploadFile.Write getString(value) objUploadFile.Close FILEFLAG = err.number on error goto 0 end if Set objFSO2 = nothing Set objUploadFile = nothing Set UploadRequest = nothing if FILEFLAG = 0 then sUrl = "./select_image.asp?catid=" & Escape(ImageCateg) & "&dir=" & Escape(sDir) & "&fld=" & Escape(sField) else sUrl = "./select_image.asp?error=02" end if Response.Redirect sUrl End If '--------------------------------------------------------------------------- ---------------- |
| All times are GMT. The time now is 05:19 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.