Upload problem....
<!--#include file ="include/dbconn.asp"--><%
'--------------------------------------------------------------------
'UPLOAD IMAGE START
'--------------------------------------------------------------------
Set Upload = Server.CreateObject("Persits.Upload")
'--------------------------------------------------------------------
' This is needed to enable the progress indicator
'--------------------------------------------------------------------
Upload.ProgressID = Request.QueryString("PID")
'--------------------------------------------------------------------
' We use memory uploads, so we must limit file size
'--------------------------------------------------------------------
Upload.SetMaxSize 1000000000, True
'--------------------------------------------------------------------
' Capture uploaded file. Save returns the number of files uploaded
'--------------------------------------------------------------------
Count = Upload.Save("C:\upload")
'--------------------------------------------------------------------
' Obtain file object
'--------------------------------------------------------------------
Set File = Upload.Files(1)
'--------------------------------------------------------------------
'Create day.month.year-hour.miunte.second.fileExt
'--------------------------------------------------------------------
Dim fileNavn
FilNavn = now() & File.ext
'--------------------------------------------------------------------
'Create instance of AspJpeg object
'--------------------------------------------------------------------
Set jpeg = Server.CreateObject("Persits.Jpeg")
'--------------------------------------------------------------------
'Open uploaded file
'--------------------------------------------------------------------
jpeg.Open( File.Path )
'--------------------------------------------------------------------
'CREATE THUMBNAIL START
'--------------------------------------------------------------------
'Resize thumbnail
jpeg.Width = "150"
'Set new height, preserve original width/height ratio on thumbnail.
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
'--------------------------------------------------------------------
'CREATE THUMBNAIL END
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'CREATE WATERMARK START
'--------------------------------------------------------------------
'Resize thumbnail
jpeg.Width = "500"
'Set new height, preserve original width/height ratio on thumbnail.
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
Jpeg.Canvas.Font.Color = &HFF0000 ' red
Jpeg.Canvas.Font.Family = "Verdana"
Jpeg.Canvas.Font.Size = "20"
Jpeg.Canvas.Font.Bold = True
Jpeg.Canvas.Print Jpeg.Width / 2, Jpeg.Height / 2, "Fotos © 2002"
'--------------------------------------------------------------------
'CREATE WATERMARK END
'--------------------------------------------------------------------
'--------------------------------------------------------------------
' Use ADO Recordset object
'--------------------------------------------------------------------
Set oRS = Server.CreateObject("adodb.recordset")
'--------------------------------------------------------------------
' Optional: check whether this file already exists using MD5 hash
'--------------------------------------------------------------------
Hash = File.MD5Hash
oRS.Open "SELECT * from tblBilder WHERE BHash='" & Hash & "'", oConn, 2, 3
If Not oRS.EOF Then
'--------------------------------------------------------------------
'If Orginalimage exists then an error message!
'--------------------------------------------------------------------
strMSG = "Orginalbilde finnes i databasen."
End If
oRS.Close
'--------------------------------------------------------------------
' Reopen recordset to insert files
'--------------------------------------------------------------------
oRS.Open "tblBilder", oConn, 2, 3
oRS.AddNew
'Upload orginal image to database.
oRS("Image_orginal") = File.Binary
'Upload watermark to database.
oRS("Image_Vannmerke") = File.Binary
'Upload thumbnail to database.
Set ThumbFile = Upload.OpenFile(file.Path)
oRS("Image_Thumbnail").Value = ThumbFile.Binary
oRS("BfilNavn") = FilNavn'Filename.
oRS("BFilSize") = File.Size'Orginal image filsize.
oRS("Bhash") = Hash
oRS.Update
'--------------------------------------------------------------------
'Close recordset
'--------------------------------------------------------------------
oRS.close
'--------------------------------------------------------------------
'Delete the file
'--------------------------------------------------------------------
File.Delete
'--------------------------------------------------------------------
'Release recordset memory.
'--------------------------------------------------------------------
Set oRS = Nothing
'--------------------------------------------------------------------
'Close connection object.
'--------------------------------------------------------------------
oConn.Close
'--------------------------------------------------------------------
'Release connetion memory
'--------------------------------------------------------------------
Set oConn = Nothing
%>
Hvordan får jeg dette scriptet til å laste opp thumbnail og watermark ferdig formatert til databasen. Eneste som blir lastet opp er orginal bilde.
- Thumbnail liten størelse
- watermark skal ha text på seg.
mvh
Morten
