473,699 Members | 2,230 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 2827

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 size and display the image... Here is my code. Problem is, I am getting a good ole red X. It looks...
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 later stage in the project, this info will be created dynamically depending on the requested image....
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 later stage in the project, this info will be created dynamically depending on the requested image....
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 = 0 Then 'Response.Write "message"
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 package, the default limit cannot be changed for me, therefore I'm stuck with the problem of how to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.