bigflood / dartexif

Dart package to decode Exif data from tiff, jpeg and heic files
https://pub.dev/packages/exif
MIT License
30 stars 29 forks source link

extract elif from http/s url #25

Closed DennisMuchiri closed 3 years ago

DennisMuchiri commented 3 years ago

hello @bigflood how do you extract elif given a file http/s url

bigflood commented 3 years ago

you can use http.get and readExifFromBytes:

final res = await http.get(Uri.parse(url));
final fileBytes = res.bodyBytes;
final data = await readExifFromBytes(fileBytes);

if (data.isEmpty) {
  print("No EXIF information found");
  return;
}

if (data.containsKey('JPEGThumbnail')) {
  print('File has JPEG thumbnail');
  data.remove('JPEGThumbnail');
}
if (data.containsKey('TIFFThumbnail')) {
  print('File has TIFF thumbnail');
  data.remove('TIFFThumbnail');
}

for (final entry in data.entries) {
  print("${entry.key}: ${entry.value}");
}