longitachi / ZLPhotoBrowser

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

Require image clipping #838

Open patryk-sredzinski opened 11 months ago

patryk-sredzinski commented 11 months ago

Feature Description

I am in a need to force user to crop image to square/circle (when he edits a profile avatar) I don't think I have seen this feature available. Planning to modify it.

Can I get any suggestions so in the end it get's merged?

longitachi commented 11 months ago
ZLPhotoConfiguration.default()
    .editImageConfiguration
    .clipRatios([.circle]) // or  .clipRatios([.wh1x1])
patryk-sredzinski commented 11 months ago

This I believe only adds clip ratio, but user is still able to not to enter clipping controller, and keep original photo.

I'd like to make him forced to clip, and also allow editing the image

longitachi commented 11 months ago

OK, this configuration can meet your needs

ZLPhotoConfiguration.default()
    .editImageConfiguration
    .tools([.clip])
    .clipRatios([.circle]) // or  .clipRatios([.wh1x1])

ZLPhotoConfiguration.default()
    .maxSelectCount(1)
    .editAfterSelectThumbnailImage(true)
    .showClipDirectlyIfOnlyHasClipTool(true)
patryk-sredzinski commented 11 months ago

Yeah, but I believe this will not let me do other editing on image right? No Drawings, no sticker, no filters.

That's why I think I'd like to add this functionality, but I'd like you to help me planning it so it works well.

longitachi commented 11 months ago

Delete .tools([.clip]) and .showClipDirectlyIfOnlyHasClipTool(true). But in this case, the user can choose not to enter the cropping interface.

So now there is no good way to support your needs.

patryk-sredzinski commented 11 months ago

Yeah, that's why I'd like to ask you what do you think I can do as a new functionality for it to be supported properly.