Jump to content

Recommended Posts

Posted (edited)

This code reads and displays the extended properties of a digital image [date taken resolution that sort of thing].

;Read an image file

#include <extprop.au3>

#include <array.au3>

$path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")

$prop = _GetExtProperty($path,-1)

_ArrayDisplay($prop,"Property Array")

With a iPhone 3G Camera photos are tagged with location data if Location Services is turned on. You can use location data with some applications and photo-sharing websites to track and post where you took your pictures.

For some reason the above code does not display the tagged location information. Why is that so?

Edit:

In Windows Photo Gallery when you select the image and display the properties under 'GPS' the Latitude and Longitude information is displayed which is the information I would like to be able to read using AutoIT.

Ant.. :)

Edited by anixon
Posted

I think it would help a lot if you would post a link to extprop.au3 or the au3 file itself. We can't help you if we don't have that information.

Posted

I think it would help a lot if you would post a link to extprop.au3 or the au3 file itself. We can't help you if we don't have that information.

CODE
;===============================================================================

; Function Name: GetExtProperty($sPath,$iProp)

; Description: Returns an extended property of a given file.

; Parameter(s): $sPath - The path to the file you are attempting to retrieve an extended property from.

; $iProp - The numerical value for the property you want returned. If $iProp is is set

; to -1 then all properties will be returned in a 1 dimensional array in their corresponding order.

; The properties are as follows:

; Name = 0

; Size = 1

; Type = 2

; DateModified = 3

; DateCreated = 4

; DateAccessed = 5

; Attributes = 6

; Status = 7

; Owner = 8

; Author = 9

; Title = 10

; Subject = 11

; Category = 12

; Pages = 13

; Comments = 14

; Copyright = 15

; Artist = 16

; AlbumTitle = 17

; Year = 18

; TrackNumber = 19

; Genre = 20

; Duration = 21

; BitRate = 22

; Protected = 23

; CameraModel = 24

; DatePictureTaken = 25

; Dimensions = 26

; Width = 27

; Height = 28

; Company = 30

; Description = 31

; FileVersion = 32

; ProductName = 33

; ProductVersion = 34

; Requirement(s): File specified in $spath must exist.

; Return Value(s): On Success - The extended file property, or if $iProp = -1 then an array with all properties

; On Failure - 0, @Error - 1 (If file does not exist)

; Author(s): Simucal (Simucal@gmail.com)

; Note(s):

;

;===============================================================================

Func _GetExtProperty($sPath, $iProp)

Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty

$iExist = FileExists($sPath)

If $iExist = 0 Then

SetError(1)

Return 0

Else

$sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))

$sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))

$oShellApp = ObjCreate ("shell.application")

$oDir = $oShellApp.NameSpace ($sDir)

$oFile = $oDir.Parsename ($sFile)

If $iProp = -1 Then

Local $aProperty[35]

For $i = 0 To 34

$aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)

Next

Return $aProperty

Else

$sProperty = $oDir.GetDetailsOf ($oFile, $iProp)

If $sProperty = "" Then

Return 0

Else

Return $sProperty

EndIf

EndIf

EndIf

EndFunc ;==>_GetExtProperty

Posted

Now send me an iPhone to test and I'll help you out :). Sorry, had to. I don't have one nor do I have a picture taken with one so I can't really test. My guess is that the location data is stored somewhere the function isn't looking, such as in the header of the image.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...