Skip to content

Commit 890d816

Browse files
authored
return originalFile when target is larger than original
1 parent 9da805d commit 890d816

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

flutter_cache_manager/lib/src/cache_managers/image_cache_manager.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ mixin ImageCacheManager on BaseCacheManager {
7575
}
7676

7777
var image = await _decodeImage(originalFile.file);
78+
79+
var shouldResize = maxWidth != null ? image.width > maxWidth : false ||
80+
maxHeight != null ? image.height > maxHeight : false;
81+
if (!shouldResize) return originalFile;
7882
if (maxWidth != null && maxHeight != null) {
7983
var resizeFactorWidth = image.width / maxWidth;
8084
var resizeFactorHeight = image.height / maxHeight;

0 commit comments

Comments
 (0)