ASP
--
Questions
--
Followers
Top Experts
ASP Jpeg
how do i resize an image to a specific width and height using aspjpeg?
here's the code i have, which uploads the file, but won't resize it.
<%
Set Upload = Server.CreateObject("Persi ts.Upload" )
' Use AspJpeg to resize image
Set Jpeg = Server.CreateObject("Persi ts.Jpeg")
' Capture and save uploaded image to the same directory as script
Upload.Save Server.MapPath("../images/ homes/")
For Each File in Upload.Files
If File.ImageType <> "JPG" Then
Response.Write "This is now a JPEG image."
File.Delete
Response.End
End If
Jpeg.Open File.Path
Jpeg.Width = 300
Jpeg.Height = 200
Response.Write ("original width: " & Jpeg.OriginalWidth & " - new width: " & Jpeg.Width & "<br>")
Response.Write ("original height: " & Jpeg.OriginalHeight & " - new height: " & Jpeg.Height & "<br>")
Jpeg.Save Server.MapPath("../images/ homes/") & File.FileName
%>
<IMG SRC="/images/homes/<% = File.FileName %>"><BR>
<%
Next
%>
here's the code i have, which uploads the file, but won't resize it.
<%
Set Upload = Server.CreateObject("Persi
' Use AspJpeg to resize image
Set Jpeg = Server.CreateObject("Persi
' Capture and save uploaded image to the same directory as script
Upload.Save Server.MapPath("../images/
For Each File in Upload.Files
If File.ImageType <> "JPG" Then
Response.Write "This is now a JPEG image."
File.Delete
Response.End
End If
Jpeg.Open File.Path
Jpeg.Width = 300
Jpeg.Height = 200
Response.Write ("original width: " & Jpeg.OriginalWidth & " - new width: " & Jpeg.Width & "<br>")
Response.Write ("original height: " & Jpeg.OriginalHeight & " - new height: " & Jpeg.Height & "<br>")
Jpeg.Save Server.MapPath("../images/
%>
<IMG SRC="/images/homes/<% = File.FileName %>"><BR>
<%
Next
%>
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
i changed jpeg.Open to jpeg.OpenBinary and i get this error
Persits.Jpeg.1 error '80040035'
Not a JPEG file: starts with 0x44 0x00
the error is line 21 which is the jpeg.OpenBinary line...
Persits.Jpeg.1 error '80040035'
Not a JPEG file: starts with 0x44 0x00
the error is line 21 which is the jpeg.OpenBinary line...
and yes... i did try to use a .jpg file. :)
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
well, the problem was that it won't overwrite the image that it is resizing. is there a setting i can turn on to allow this? it seems to work fine if i set the output to another directory.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
i've solved this by setting the output image with a different prefix to the filename. thanks for the help.
FYI, I had an email conversation with Peter Persits of Persits Software (ASPUpload and ASPJPEG), and he explained that you can't overwrite an image while it's still open. So, if i wanted this to work, i would have to save it as a temporary file, delete the original, save it as the original filename, and delete the temp file.
ASP
--
Questions
--
Followers
Top Experts
Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.