longitachi / ZLPhotoBrowser

Wechat-like image picker. Support select photos, videos, gif and livePhoto. Support edit image and crop video. 微信样式的图片选择器,支持预览/相册内拍照及录视频、拖拽/滑动选择,编辑图片/视频,支持多语言国际化等功能;

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

可以加个选择原图后,在原图下放显示选择图片的大小吗?

Ryan0520 opened this issue · comments

Issue Description

Description and Steps

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

Info

ZLPhotoBrowser version: e.g. 4.4.6
Device: e.g. iPhone 14 Pro
Device version: e.g. iOS 16.0
Xcode version: e.g. Xcode 14.0

Configuration code of ZLPhotoConfiguration

Paste your code here.

有个需求是如果在选择原图的模式下,需要限制最大只能选择20MB以内的图片。我看了下只有限制视频的大小,没有限制图片的大小。

commented

/// This block will be called before selecting an image, the developer can first determine whether the asset is allowed to be selected.
/// Only control whether it is allowed to be selected, and will not affect the selection logic in the framework.
/// - Tips: If the choice is not allowed, the developer can toast prompt the user for relevant information.
public var canSelectAsset: ((PHAsset) -> Bool)?

可以用这个去限制选择,不过框架外现在拿不到用户是否勾选了原图按钮的状态

commented

显示原图大小这个后面有空了加下

/// This block will be called before selecting an image, the developer can first determine whether the asset is allowed to be selected.
/// Only control whether it is allowed to be selected, and will not affect the selection logic in the framework.
/// - Tips: If the choice is not allowed, the developer can toast prompt the user for relevant information.
public var canSelectAsset: ((PHAsset) -> Bool)?

可以用这个去限制选择,不过框架外现在拿不到用户是否勾选了原图按钮的状态

我现在的做法是在这个block去做,但是在外界没法拿到用户是否勾选了原图按钮的状态就很难搞了。

commented

你这个需求也有点麻烦,勾选原图按钮时,限制20M以内。就算能拿到原图按钮状态,用户也可以先在未勾选原图按钮时选择一个大于20M的照片,然后再勾选原图按钮

所以这个需求就是点击原图那一刻也要判断图片大小是否符合在一点范围

commented

定制化需求可以自己fork一下修改。或者可以用户选了原图,你拿到回调后判断大小压缩一下

定制化需求可以自己fork一下修改。或者可以用户选了原图,你拿到回调后判断大小压缩一下

嗯,估计我得把fork加一些定制化的需求调整才行。每隔一段时间合并一些新特性

在滑动选择图片的那个手势处理有点问题,如果当手势移动到屏幕外的话,有些状态没有重置,导致再次移动选择时会出现异常情况,我加了一下判断就没问题了,作者你看下。
3141700102524_ pic

commented

好的,我这边复现了下,我改下这块逻辑