Skip to content

[image_picker] image file in gallery is deleted by image_picker if it was scaled #29664

@microdog

Description

@microdog

When picking an image from the gallery using the image_picker plugin, the image file in the gallery is deleted by image_picker if the image is scaled(exceeds the maxWidth or maxHeight limit).

It seems that this issue was introduced in flutter/plugins#1288 which was intended to delete the original image captured from the camera(#23500), but the patch forgot to check the image source.

Steps to Reproduce

  1. use the image_picker plugin: 0.5.0+9 (issue introduced in 0.5.0+6)
  2. just write a simple demo to pick an image from the gallery with maxWidth and maxHeight set.
  3. pick an image from the gallery which exceeds the maxWidth and maxHeight limit.
  4. Boom. The original image file just vanished.

Logs

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.3.13, on Mac OS X 10.14.3 18D109, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.5)
[✓] VS Code (version 1.32.3)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions