Monday, November 2, 2009

EXIF Reader in Flex+AIR II


Now that files and folders can be selected, I move on to the next step, which contains the following substeps:

  • Validating the selected files/folders
  • Batch Loading the files
  • On every file load, get the EXIF info for that file and save it as XML
A.Validating the selected files/folders


For the purpose of validating and loading Files I have created a class called "EXIFReaderClass"


<mx:Button x="10" y="534" label="Run EXIFReader" width="482" click="startReading()"/>



private function startReading():void{
             objEXIFReader.init(fsTree.selectedPaths)
}

The selectedPaths contains all the selections from the FileSystemTree component.


The validation is done in the EXIFReader Class:












EXIF Reader in Flex+AIR

Hi
I was posting some images on a blog, and I required to post the EXIF tags info there. It was a tedious job typing all those values, and I thought then to make a app that would do this for me.
First I tried .net, then on a search came to know of the EXIF Reader available on google code.

I then created this app for reading the EXIF tags on a image file using Flex and AIR. I will be posting the step by process I used for development.

Let me know if there are any issues or suggestions....

Step One: File and Folder Selection
The first step was to allow for file and folder selection. I used the FileSystemTree Component(AIR Only) for this purpose.
I added two buttons for file and folder selection and accordingly modified the FileSystemTree.



The mxml code for this :



<mx:FileSystemTree id="fsTree" enabled="false" showIcons="true" fileChoose="onChooseFile(event)" x="10" y="36" width="482" height="460"/>
<mx:Button id="fileBtn" x="103" y="504" label="Select A File" click="openDialogFile()"/>
<mx:Button id="folderBtn" x="275" y="504" label="Select A Folder" click="openDialogFolder()"/>



The methods for the file and folder selection are:



private function openDialogFile():void{
fsTree.enumerationMode = "filesAndDirectories"
fsTree.enabled = true;
fsTree.allowMultipleSelection=true;
fileBtn.enabled = false;
folderBtn.enabled = true;
}
private function openDialogFolder():void{
fsTree.enumerationMode="directoriesOnly";
fsTree.enabled = true;
fsTree.allowMultipleSelection=false;
fileBtn.enabled = true;
folderBtn.enabled = false;
}


This allows for file and folder selection.