Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.44k stars 656 forks source link

Cached image resizing does not work. #669

Closed jpolstre closed 3 years ago

jpolstre commented 3 years ago

🐛 Bug Report

Expected behavior

I handle a lot of images in my app, in version 2.5.0 before null security it worked correctly when I changed the memCache parameters, for example:

  CachedNetworkImage(
      imageUrl: 'https://www.themoviedb.org/t/p/w220_and_h330_face/9DfnxpUOwu6uxYwrcX8DwOmrrKU.jpg',
      memCacheWidth: 55,
      memCacheHeight: 82,
....

Reproduction steps

Now with versions after 2.0.5 with null security (I'm using 3.1.0, I also tried the others) with the attributes: memCacheWidth memCacheHeight, maxWidthDiskCache, maxHeightDiskCache, no change is made in the image quality, example:

  CachedNetworkImage(
      imageUrl: 'https://www.themoviedb.org/t/p/w220_and_h330_face/9DfnxpUOwu6uxYwrcX8DwOmrrKU.jpg',
      memCacheWidth: 55,
      memCacheHeight: 82,
....

It doesn't work either:

  CachedNetworkImage(
      imageUrl: 'https://www.themoviedb.org/t/p/w220_and_h330_face/9DfnxpUOwu6uxYwrcX8DwOmrrKU.jpg',
     maxWidthDiskCache: 55,
     maxHeightDiskCache: 82,
...

How do I reduce the weight of the cached images in the current versions, to obtain results like in version 2.5.0? I am using null security and I cannot downgrade the package to version 2.5.0. Thanks

Configuration

Version: cached_network_image: ^3.1.0

Platform:

Flutter doctor:

[✓] Flutter (Channel stable, 2.5.3, on Ubuntu 20.04.3 LTS 5.4.0-80-generic, locale es_BO.UTF-8) • Flutter version 2.5.3 at /home/marcelo/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (2 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /home/marcelo/Android/Sdk • Platform android-31, build-tools 30.0.3 • Java binary at: /snap/android-studio/current/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[✓] Chrome - develop for the web • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop • clang version 10.0.0-4ubuntu1 • cmake version 3.20.0 • ninja version 1.10.0 • pkg-config version 0.29.1

[✓] Android Studio (version 2020.3) • Android Studio at /snap/android-studio/115/android-studio • Flutter plugin version 59.0.2 • Dart plugin version 203.8292 • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Android Studio • Android Studio at /snap/android-studio/current/android-studio/ • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /snap/android-studio/current/android-studio/ • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.61.2) • VS Code at /usr/share/code • Flutter extension version 3.27.0

[✓] Connected device (4 available) • DRA LX3 (mobile) • QDB9K18C14905052 • android-arm • Android 8.1.0 (API 27) • sdk google atv x86 (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator) • Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.3 LTS 5.4.0-80-generic • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69

jpolstre commented 3 years ago

I was using CacheManager,

CacheManager instanceCacheManager = CacheManager(
  Config(
    key,
    stalePeriod: const Duration(days: 7),
    maxNrOfCacheObjects: 200,
    repo: JsonCacheInfoRepository(databaseName: key),

    fileService: HttpFileService(),
  ),
);
  CachedNetworkImage(
      imageUrl: 'https://www.themoviedb.org/t/p/w220_and_h330_face/9DfnxpUOwu6uxYwrcX8DwOmrrKU.jpg',
     maxWidthDiskCache: 55,
     maxHeightDiskCache: 82,
    // cacheManager: instanceCacheManager,

When I removed it it started to work properly.