473,560 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ


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.CreateOb ject("Persits.J peg")

' 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.OriginalWi dth * Upload.Form("sc ale") / 100
jpeg.Height = jpeg.OriginalHe ight * Upload.Form("sc ale") / 100

SavePath = Server.MapPath( "/bilde/") & File.ExtractFil eName

' AspJpeg always generates JPEG thumbnails regardless of original format.
' If the original file was not a JPEG, append .JPG extension.
If UCase(Right(Sav ePath, 3)) <> "JPG" Then
SavePath = SavePath & ".jpg"
End If

jpeg.Save SavePath



if Request.QuerySt ring("action") = "upload" then
Server.ScriptTi meout = 1200
Response.Expire s = 0
Response.Buffer = TRUE

Dim UploadRequest
Set UploadRequest = CreateObject("S cripting.Dictio nary")

ByteCount = Request.TotalBy tes

if ByteCount > Application("Ma xFileSize2Uploa d") then
Response.Redire ct "./select_image.as p?error=05"
end if
RequestBin = Request.BinaryR ead(byteCount)
BuildUploadRequ est RequestBin

Dim aux, aux1
Dim ImageCateg, ContentType, FilePathName, FileName, Value

ImageCateg = Unescape(Upload Request.Item("i npcatid").Item( "Value")) 'Image

on error resume next
ContentType = UploadRequest.I tem("inpFile"). Item("ContentTy pe")
FILEFLAG = err.number
on error goto 0

if FILEFLAG = 0 then
ContentType = UploadRequest.I tem("inpFile"). Item("ContentTy pe")
FilePathName = UploadRequest.I tem("inpFile"). Item("FileName" )
FileName =
Right(filepathn ame,Len(filepat hname)-InstrRev(filepa thname,"\"))
Value = UploadRequest.I tem("inpFile"). Item("Value")
FileName = ""
end if

Dim objFSO2
Dim objUploadFile

if FileName<>"" then
on error resume next
Set objFSO2 = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set objUploadFile = objFSO2.CreateT extFile(ImageCa teg&"\"&FileNam e)
objUploadFile.W rite getString(value )
objUploadFile.C lose
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.as p?catid=" & Escape(ImageCat eg) & "&dir=" &
Escape(sDir) & "&fld=" & Escape(sField)
sUrl = "./select_image.as p?error=02"
end if

Response.Redire ct sUrl
End If
Jul 19 '05 #1
0 2806

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

Similar topics

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 120''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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 Image:<BR> <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P> Thumbnail (50% reduction):<BR>
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 point me to the resources for learning to do this. Thnanks in Advance.
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 following code to randomly select an image under a random set of folders from my gallery. Once that is done, I call sendbinary.asp which should...
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 the way to write the code to be able to use aspjpeg with vbscript in asp.net Who can give me some complete code examples to do this?
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 the image and the URL of the website. In the code image.asp I define the file name of the image (img), the comment (txt) and the url (url). In the...
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 the image and the URL of the website. In the code image.asp I define the file name of the image (img), the comment (txt) and the url (url). In the...
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 Upload = Server.CreateObject("Persits.Upload") ' Capture uploaded file. Save returns the number of files uploaded 'Count = Upload.Save(Path) 'If Count =...
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 to a remote web server, as the hosting package the web site is on is IIS6 and has a default file upload size limit of 200kb. As it's a shared hosting...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.