Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullRef - when reading path #90

Open
MrIThompson opened this issue Sep 13, 2021 · 0 comments
Open

NullRef - when reading path #90

MrIThompson opened this issue Sep 13, 2021 · 0 comments

Comments

@MrIThompson
Copy link

MrIThompson commented Sep 13, 2021

Hello,

I am using your library in Unity and want to grab the meta details from a photo. It is coming up with a Null Reference.

Anybody know what I am doing wrong? Path does return - "/storage/emulated/0/Android/media/..."

private async void GetMetaData(int index, string path, string width, string height)
{
		    Debug.Log(path);
		    await ImageFile.FromFileAsync(path).ContinueWith(t =>
		    {
			    var file = t.Result;
			    foreach(var property in file.Properties)
			    {
				    Console.WriteLine(property.Name);
			    }
			    var latTag = file.Properties.Get<GPSLatitudeLongitude>(ExifTag.GPSLatitude);
			    Debug.Log(latTag.ToString());
		    
			    var longTag = file.Properties.Get<GPSLatitudeLongitude>(ExifTag.GPSLongitude);
			    Debug.Log(longTag.ToString());
		    
			    var dateTimeTag = file.Properties.Get(ExifTag.DateTime);
			    DateTime dateTime = ((ExifDateTime)dateTimeTag).Value;
		    
			    Debug.Log("Getting MetaData Lat- "+latTag.ToFloat()+", Long- "+longTag.ToFloat()+", DateTime- "+dateTime.ToString("dd/MM/yyyy hh:mm"));
		    
			    SaveMetaData(index, latTag.ToFloat(), longTag.ToFloat(), dateTime.ToString("dd/MM/yyyy hh:mm"), width, height);
		    });
	    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant