Forums

ASP

This topic is locked

ASPJPEG

Posted 02 Nov 2003 22:11:17
1
has voted
02 Nov 2003 22:11:17 jacque jd posted:
i have the Pure ASP uploader page that upload the images to database, and trying to add thumbnail picture using ASPJPEG, but no luck.
i did add filed to database thumbnail, and temp folder, but just getting errors on pure uploader image.
how do i include the code to my uploader page and where:

<%
' 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("c:\upload"

If Count = 0 Then
Response.Write "No images selected. <A HREF=""form.asp"">Try again</A>."
Response.End
Else

' Obtain File object representing uploaded file
Set File = Upload.Files(1)

' Is this a valid image file?
If File.ImageType <> "UNKNOWN" Then

' 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 = "c:\upload\small_" & 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
End If
End If
%>

Replies

Replied 03 Nov 2003 10:33:07
03 Nov 2003 10:33:07 Martha Graham replied:
Check the Smart Image Processor extension:
www.dmxzone.com/go?3965
This extension will resize the images that are uploaded and/or create thumbnails as well.

Martha Graham
DMXzone manager

Reply to this topic