PC Review


Reply
Thread Tools Rate Thread

Photo Metadata

 
 
ainow
Guest
Posts: n/a
 
      9th Jul 2008
Is there a way to retrieve photo metadata using VBA / MS Access?
Specifically “Data taken”

Thanks
Jim
 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      9th Jul 2008
You might want to take a look at

http://www.veign.com/code-view.php?type=app&codeid=104
http://pagesperso-orange.fr/pierre.g...aturesgfl.html

Also, I had been working on an image function a while back. It is below and
feel free to take it and modify it to suit your needs.

'---------------------------------------------------------------------------------------
' Procedure : GetFileProperties
' DateTime : 2006-Nov-24 10:50
' Author : CARDA Consultants Inc. - Main
' Purpose :
'---------------------------------------------------------------------------------------
'
Function GetFileProperties(strFilewFullPath)
'On Error GoTo GetFileProperties_Error

Const arrSize = 39
Dim strFile As String
Dim strPath As String
Dim i As Integer
Dim fsize As Integer
Dim idate As Date
Dim idimension As String

Dim arrHeaders(arrSize)


Set objShell = CreateObject("Shell.Application")

strFile = Dir(strFilewFullPath)
strPath = Left(strFilewFullPath, InStrRev(strFilewFullPath, "\") - 1)

Set objFolder = objShell.Namespace(strPath & "\")

For i = 0 To arrSize
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
'Debug.Print objFolder.GetDetailsOf(objFolder.Items, i)
Next i

For Each strFileName In objFolder.Items
If strFileName = strFile Then
For i = 0 To arrSize

Select Case arrHeaders(i)
'Retrieve only the properties that we are interested in
Case "Size"
fsize = Left(objFolder.GetDetailsOf(strFileName, i),
InStr(objFolder.GetDetailsOf(strFileName, i), " "))
Case "Dimensions"
idimension = objFolder.GetDetailsOf(strFileName, i)
Case "Date Picture Taken"
idate = objFolder.GetDetailsOf(strFileName, i)
End Select
Next i
End If
Next strFileName

If IsNull(fsize) Then fsize = 0
If IsNull(idimension) Then idimension = "unavailable"
If IsNull(idate) Then fsize = ""

GetFileProperties = fsize & "," & idimension & "," & idate

GetFileProperties_Error:
If Err.Number <> 0 Then
MsgBox "MS Access has generated the following error" & vbCrLf &
vbCrLf & "Error Number: " & _
Err.Number & vbCrLf & "Error Source: FileInformation /
GetFileProperties" & vbCrLf & _
"Error Description: " & Err.Description, vbCritical, "An Error has
Occured!"
End If
Exit Function

End Function
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"ainow" wrote:

> Is there a way to retrieve photo metadata using VBA / MS Access?
> Specifically “Data taken”
>
> Thanks
> Jim

 
Reply With Quote
 
ainow
Guest
Posts: n/a
 
      10th Jul 2008
I made some modification and made a class and it works, thanks.

Jim


"Daniel Pineault" wrote:

> You might want to take a look at
>
> http://www.veign.com/code-view.php?type=app&codeid=104
> http://pagesperso-orange.fr/pierre.g...aturesgfl.html
>
> Also, I had been working on an image function a while back. It is below and
> feel free to take it and modify it to suit your needs.
>
> '---------------------------------------------------------------------------------------
> ' Procedure : GetFileProperties
> ' DateTime : 2006-Nov-24 10:50
> ' Author : CARDA Consultants Inc. - Main
> ' Purpose :
> '---------------------------------------------------------------------------------------
> '
> Function GetFileProperties(strFilewFullPath)
> 'On Error GoTo GetFileProperties_Error
>
> Const arrSize = 39
> Dim strFile As String
> Dim strPath As String
> Dim i As Integer
> Dim fsize As Integer
> Dim idate As Date
> Dim idimension As String
>
> Dim arrHeaders(arrSize)
>
>
> Set objShell = CreateObject("Shell.Application")
>
> strFile = Dir(strFilewFullPath)
> strPath = Left(strFilewFullPath, InStrRev(strFilewFullPath, "\") - 1)
>
> Set objFolder = objShell.Namespace(strPath & "\")
>
> For i = 0 To arrSize
> arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
> 'Debug.Print objFolder.GetDetailsOf(objFolder.Items, i)
> Next i
>
> For Each strFileName In objFolder.Items
> If strFileName = strFile Then
> For i = 0 To arrSize
>
> Select Case arrHeaders(i)
> 'Retrieve only the properties that we are interested in
> Case "Size"
> fsize = Left(objFolder.GetDetailsOf(strFileName, i),
> InStr(objFolder.GetDetailsOf(strFileName, i), " "))
> Case "Dimensions"
> idimension = objFolder.GetDetailsOf(strFileName, i)
> Case "Date Picture Taken"
> idate = objFolder.GetDetailsOf(strFileName, i)
> End Select
> Next i
> End If
> Next strFileName
>
> If IsNull(fsize) Then fsize = 0
> If IsNull(idimension) Then idimension = "unavailable"
> If IsNull(idate) Then fsize = ""
>
> GetFileProperties = fsize & "," & idimension & "," & idate
>
> GetFileProperties_Error:
> If Err.Number <> 0 Then
> MsgBox "MS Access has generated the following error" & vbCrLf &
> vbCrLf & "Error Number: " & _
> Err.Number & vbCrLf & "Error Source: FileInformation /
> GetFileProperties" & vbCrLf & _
> "Error Description: " & Err.Description, vbCritical, "An Error has
> Occured!"
> End If
> Exit Function
>
> End Function
> --
> Hope this helps,
>
> Daniel Pineault
> http://www.cardaconsultants.com/
> For Access Tips and Examples: http://www.devhut.net
> Please rate this post using the vote buttons if it was helpful.
>
>
>
> "ainow" wrote:
>
> > Is there a way to retrieve photo metadata using VBA / MS Access?
> > Specifically “Data taken”
> >
> > Thanks
> > Jim

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing dll from VBA ,... JPG photo metadata edit.. Picasa Harry Sorensen Microsoft Excel Programming 0 27th Oct 2009 01:14 AM
Re: Universal Metadata with Photo Gallery? mxh Windows Vista General Discussion 1 29th Mar 2007 04:16 PM
Universal Metadata with Photo Gallery? mxh Windows Vista File Management 3 29th Mar 2007 04:16 PM
Universal Metadata with Photo Gallery? mxh Windows XP General 2 29th Mar 2007 04:23 AM
Re: How can I show a photo's metadata in Photo Gallery Rob Giordano \(Crash\) Microsoft Frontpage 0 24th Aug 2005 11:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:10 PM.