File Properties for fil tilsvarende FileDateTime søges
Hej,jeg er ved at lave en MySQL db med informationer om mine digitale billeder. Db'en skal bruges til et website, efterfølgende. Jeg kan bruge file properties til at finde
Created & filesize(FileDateTime & FileLen)
Men jeg ikke kan finde:
imagesize (width=1280 x height=1024)
Camera model (Pentax Optio, Minolta Dimage oetc)
I det hele taget de properties som jeg kan se i details for den folder, hvor billederne er pt. i min NTFS-mappe.
Her er den kode jeg bruger pt. (Den ligger i et Excel-modul)
---------
Sub ReadAllPictures()
Dim FS As FileSearch
Dim FilePath As String, FileSpec As String
Dim thisFilePath As String
Dim thisFileName As String
Dim thisFileContributor As String
Dim i As Long
Dim v As Variant
Dim t As Variant
Dim szSQL As String
Dim rsContributor As ADODB.Recordset
Dim myconn As New ADODB.Connection
Dim myrs As New Recordset
Dim mySQL As String
Dim myrows As Long
Dim SQLInsert As String
Dim rsTemp As Recordset
Dim Contributorid As Integer
'************** Open to the database
myconn.Open "DSN=MySQL_ihall"
Set myrs.ActiveConnection = myconn
myrs.CursorLocation = adUseClient
myrs.Open
myrows = myrs.RecordCount
'******************************
FilePath = "C:\Inetpub\wwwroot\igroups\images"
FileSpec = "*.jpg"
'******************************
'find billederne filerne
Set FS = Application.FileSearch
With FS
.LookIn = FilePath
.Filename = FileSpec
.SearchSubFolders = True
.Execute
If .FoundFiles.Count = 0 Then
MsgBox ("Ingen filer fundet")
Exit Sub
End If
'hent data
For i = 1 To FS.FoundFiles.Count
v = Split(.FoundFiles(i), Application.PathSeparator)
thisFileName = v(UBound(v))
thisFileContributor = v(UBound(v) - 1)
' Find contributor among ihallusers:
Set rsTemp = New Recordset
Set rsTemp.ActiveConnection = myconn
mySQL = "SELECT * from ihalluser where firstname='" & thisFileContributor & "'"
myrs.Source = mySQL
myrs.CursorLocation = adUseClient
myrs.Open
If myrs.EOF = True Then
Contributorid = myrs.Fields("id").Value
Else
While Not myrs.EOF
Contributorid = myrs.Fields("id").Value
myrs.MoveNext
Wend
End If
t = Split(thisFileContributor, " ")
myfilecontributor = t(0)
thisFilePath = Left(.FoundFiles(i), InStrRev(.FoundFiles(i), Application.PathSeparator))
' List the created/modified date and the number of bytes
' for the file.
MsgBox Prompt:="'" & .FoundFiles(i) & "' was created or last " & _
"modified on " & FileDateTime(pathname:=.FoundFiles(i)) & "."
MsgBox Prompt:="'" & .FoundFiles(i) & "' contains " & _
FileLen(pathname:=.FoundFiles(i)) & " bytes."
Next i
End With
