473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
'---------------------------------------------------------------------------
----------------
Jul 19 '05 #1
0 2777

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
24
by: Mark Sargent | last post by:
Hi All, response.write FilePath gives this path, ImageName.jpeg but the image(s) doesn't display in the below code. What am I missing..? Cheers. <%Response.Write FilePath%> Original...
3
by: a new guy | last post by:
Is it possible to do any photo (jpg) maniputlation in an ASP script? I'd like to be able to rotate a photo. Also, if it can be done, reduce a file size to produce a thumbnail. If so, can anyone...
1
by: audiopro | last post by:
I am having some trouble here, and my brain is running on empty. I am not an expert ASP coder, so forgive me for what is probably sloppy code, and not the best... At any rate, I have created the...
3
by: Tony | last post by:
Hello, I'm using already a long time aspjpeg in asp to add my logo and some text over my images on my website. Since a couple of months I changed over to asp.net in vbscript. But I don't find...
0
by: Tony | last post by:
Hello I have a working code for asp that I want to use now in asp.net. The code is included below. With this code I create a red bar on the bottom of an image, in which I give some comment on...
2
by: Tony | last post by:
Hello I have a working code for asp that I want to use now in asp.net. The code is included below. With this code I create a red bar on the bottom of an image, in which I give some comment on...
0
by: dann2 | last post by:
hello, i try to upload in an access db two pictures at the same time. i use the adjusted sample code from persits. it looks like this: ... '<% ' Create an instance of AspUpload object 'Set...
2
by: nicky77 | last post by:
Hi there, I'm brand new to ASP (from PHP background) and i am developing some content management for a web site. I'm having a problem with the fact that I want to allow image files to be uploaded...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.