1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Exif write data to image metadata using native_exif giving exceptioin

Discussão em 'Mobile' iniciado por Stack, Outubro 26, 2024 às 04:02.

  1. Stack

    Stack Membro Participativo

    This is my permissions file:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- The INTERNET permission is required for development. Specifically,
    the Flutter tool needs it to communicate with the running application
    to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.WRITE_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.WRITE_MEDIA_VIDEO" />
    </manifest>


    I have added this:

    <activity
    android:requestLegacyExternalStorage="true"



    Getting this error:

    E/DartMessenger(19487): Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Images/IMG-20241024-WA0005.jpg: open failed: EACCES (Permission denied)


    When I try writing exif data of file. Here is my code:

    if (imagePath.isNotEmpty && tags.isNotEmpty) {
    List<String> tagList = tags.split(',').map((tag) => tag.trim()).toList();
    print("Adding tags to $imagePath: $tagList");
    exif = await Exif.fromPath(imagePath);

    try {
    await exif!.writeAttribute('UserComment', tagList.join(','));
    print("Tags written to EXIF metadata for $imagePath");
    } catch (e) {
    print("Error writing tags to EXIF metadata: $e");
    } finally {
    await exif!.close();
    }
    }
    }


    Maybe I am overlooking something. Its been hours and I am unable to figure out. Any help would be really appreciated. Thanks.

    Continue reading...

Compartilhe esta Página