Giter Club home page Giter Club logo

longitachi / zlphotobrowser Goto Github PK

View Code? Open in Web Editor NEW
4.8K 75.0 961.0 101.15 MB

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

License: MIT License

Objective-C 3.81% Ruby 0.07% Swift 96.12%
imagepicker editimage editvideo photos gif livephoto photolibrary picker swift gallery

zlphotobrowser's Introduction

Version Carthage compatible SPM supported License Platform Language Usage

image


English | 简体中文

ZLPhotoBrowser is a Wechat-like image picker. Support select normal photos, videos, gif and livePhoto. Support edit image and crop video.

Directory

Detailed usage of Swift and OC, please refer to Wiki.

If you only want to use the image edit feature, please move to ZLImageEditor.

Features

  • Portrait and landscape.
  • Two framework style.
  • Preview selection (Support drag and drop).
  • Library selection (Support sliding selection).
  • Image/Gif/LivePhoto/Video.
  • Customize the maximum number of previews or selection, the maximum and minimum optional duration of the video.
  • Customize the number of columns displayed in each row.
  • Image editor (Draw/Crop/Image sticker/Text sticker/Mosaic/Filter/Adjust(Brightness, Contrast and Saturation)), (Draw color can be customized; Crop ratio can be customized; Filter effect can be customized; You can choose the editing tool you want).
  • Video editor.
  • Custom camera.
  • Multi-language.
  • Selected index.
  • Selected/unselectable state shadow mask.
  • The selected photos are displayed at the bottom of the big picture interface, which can be dragged and sorted.
  • The camera's internal photo cell can displays the captured images of the camera.
  • Customize font.
  • The color of each part of the framework can be customized (Provide dynamic color can support light/dark mode).
  • Customize images.

If you have good needs and suggestions in use, or encounter any bugs, please create an issue and I will reply in time.

Requirements

  • iOS 10.0
  • Swift 5.x
  • Xcode 13.x

Usage

  • Preview selection
let ps = ZLPhotoPreviewSheet()
ps.selectImageBlock = { [weak self] results, isOriginal in
    // your code
}
ps.showPreview(animate: true, sender: self)
  • Library selection
let ps = ZLPhotoPreviewSheet()
ps.selectImageBlock = { [weak self] results, isOriginal in
    // your code
}
ps.showPhotoLibrary(sender: self)
  • Pay attention, you need to add the following key-value pairs in your app's Info.plist
// If you don’t add this key-value pair, multiple languages are not supported, and the album name defaults to English
Localized resources can be mixed   YES

Privacy - Photo Library Usage Description

Privacy - Camera Usage Description

Privacy - Microphone Usage Description

Change Log

More logs

● 4.5.4
  Add:
    Support iOS18.
    Enhance the user experience of the image cropping interface and optimize the animation effects.
    Support for setting `VideoMirrored` in the custom camera.
  Fix:
    Fix the issue where some UI elements are displayed incorrectly on phones without a notch.
● 4.5.3
  Add:
    Support customizing the alert for when there is no permission.
    Add configuration option to center tools in tools collection view.
  Fix:
    Fix the bug where the crop ratio view is not hidden when there is only one ratio in the cropping interface.
    Fix a bug that may cause failure when saving images from iCloud to local storage.
● 4.5.2
  Fix:
    Fix the bug in the image cropping interface where the image is not displayed correctly when zooming in and the crop ratio is not 0.
...

Languages

🇨🇳 Chinese, 🇺🇸 English, 🇯🇵 Japanese, 🇫🇷 French, 🇩🇪 German, 🇷🇺 Russian, 🇻🇳 Vietnamese, 🇰🇷 Korean, 🇲🇾 Malay, 🇮🇹 Italian, 🇮🇩 Indonesian, 🇪🇸 Spanish, 🇵🇹 Portuguese, 🇹🇷 Turkish, 🇸🇦 Arabic, 🇳🇱 Dutch.

Installation

There are four ways to use ZLPhotoBrowser in your project:

  • using CocoaPods
  • using Carthage
  • using Swift Package Manager
  • manual install (build frameworks or embed Xcode Project)

CocoaPods

To integrate ZLPhotoBrowser into your Xcode project using CocoaPods, specify it to a target in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target 'MyApp' do
  # your other pod
  # ...
  pod 'ZLPhotoBrowser'
end

Then, run the following command:

$ pod install

If you cannot find the latest version, you can execute pod repo update first

Carthage

To integrate ZLPhotoBrowser into your Xcode project using Carthage, specify it in your Cartfile:

github "longitachi/ZLPhotoBrowser"

Then, run the following command to build the ZLPhotoBrowser framework:

$ carthage update

If you get an error like Building universal frameworks with common architectures is not possible. The device and simulator slices for "ZLPhotoBrowser" both build for: arm64 Rebuild with --use-xcframeworks to create an xcframework bundle instead. Click this link.

Swift Package Manager

  1. Select File > Add Packages. Enter https://github.com/longitachi/ZLPhotoBrowser.git in the "Choose Package Repository" dialog.
  2. In the next page, specify the version resolving rule as "Up to Next Major" with "4.5.4" as its earliest version.
  3. After Xcode checking out the source and resolving the version, you can choose the "ZLPhotoBrowser" library and add it to your app target.

Support

  • ★ Star this repo.
  • Support with or or

Demo Effect

  • Selection image image image

  • Image editor

image

  • Video editor

image

  • Multi-language

image

  • Custom camera

image

zlphotobrowser's People

Contributors

baymax0 avatar c128128 avatar changsanjiang avatar cwftw avatar goodheart avatar hstdt avatar iliuchang avatar kagenzhao avatar kinarobin avatar kkkgit avatar kordem avatar lastsoul avatar longitachi avatar ly541349042 avatar maligh avatar mouse-lin avatar patryk-sredzinski avatar ruby109 avatar skytoup avatar sunxb avatar towayamashita avatar xiaoyouprince avatar yongwoo89 avatar zhugexiaobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zlphotobrowser's Issues

Can't remember the selected items

I have selected 3 photos, then I open actionSheet again, but, the choosing items don't have a tag is selected. Could you fix it, thank you!

At the same time, the selected items can't be removed

提些建议

增加视频选择功能以及用户自己选择图片的时候,展示图片cell是否圆角以及弧度的大小.

提交个BUG

图片浏览器来回看图片,有时能放大的图片滑动回来后不能放大了

  • (void)resetSubviewSize
    {
    CGRect frame;
    frame.origin = CGPointZero;

    UIImage *image = self.imageView.image;
    CGFloat imageScale = image.size.height/image.size.width;
    CGFloat screenScale = kViewHeight/kViewWidth;
    if (image.size.width <= CGRectGetWidth(self.frame) && image.size.height <= CGRectGetHeight(self.frame)) {
    frame.size.width = image.size.width;
    frame.size.height = image.size.height;
    } else {
    if (imageScale > screenScale) {
    frame.size.height = CGRectGetHeight(self.frame);
    frame.size.width = CGRectGetHeight(self.frame)/imageScale;
    } else {
    frame.size.width = CGRectGetWidth(self.frame);
    frame.size.height = CGRectGetWidth(self.frame) * imageScale;
    }
    }
    self.scrollView.zoomScale = 1;//差了这句
    self.scrollView.contentSize = frame.size;
    [self.scrollView scrollRectToVisible:self.bounds animated:NO];
    self.containerView.frame = frame;
    self.containerView.center = self.scrollView.center;
    self.imageView.frame = self.containerView.bounds;
    }

使用cocoapod集成,多选照片报错

使用cocoapod集成,多选照片报错(PS:手动集成就没有问题),报错如下:
[Generic] Creating an image format with an unknown type is error.
希望能够解决。

图片选择以后返回数组的问题

你现在的是选择照片以后返回的数据,是根据照片在相册里面的先后次序返回的。我现在需要的是我选择的照片的先后顺序来返回数据,这个该怎么改才能实现呢??最近在做项目很急。

发现几个BUG

bug
我在测试的时候,发现当先添加一张通过拍照的照片,再添加一张本地相册里面的照片。添加本地照片后,又取消前面添加的本地图片,会在我上面截图的地方崩溃。
还有一个问题:当我添加好照片后,重新进入照片选择器里面,在下面显示已选择图片的数组里面并没有我第一次通过拍照的图片。其实我觉得使用拍照功能获取的照片直接保存到本地就可以了。

照片选择返回结果

返回的结果是image数组,会不会很占内存?是不是返回一个路径更合适?

提示无显示

当显示过提示后,再pre....ViewController 后提示就显示不出来,后被后面pre 的View给盖住
if (toastView.superview != [UIApplication sharedApplication].keyWindow) {
[toastView removeFromSuperview];
[[UIApplication sharedApplication].keyWindow addSubview:toastView];
}
应该改成
if (toastView.superview ) {
[toastView removeFromSuperview];
[[UIApplication sharedApplication].keyWindow addSubview:toastView];
}

发现第一次进去到多相册选择的时候代码会崩溃到以下代码,请问如何解决?

  • (void)pushThumbnailVCWithIndex:(NSInteger)index animated:(BOOL)animated
    {
    ZLPhotoAblumList *ablum = _arrayDataSources[index];//开始请求权限的时候,会奔溃到这句

    ZLThumbnailViewController *tvc = [[ZLThumbnailViewController alloc] initWithNibName:@"ZLThumbnailViewController" bundle:kZLPhotoBrowserBundle];
    tvc.title = ablum.title;
    tvc.maxSelectCount = self.maxSelectCount;
    tvc.isSelectOriginalPhoto = self.isSelectOriginalPhoto;
    tvc.assetCollection = ablum.assetCollection;
    tvc.arraySelectPhotos = self.arraySelectPhotos.mutableCopy;
    tvc.sender = self;
    tvc.DoneBlock = self.DoneBlock;
    tvc.CancelBlock = self.CancelBlock;
    [self.navigationController pushViewController:tvc animated:animated];
    }

相册位置错乱

每次进入选择相册界面,相册的位置都是不一样的,总是错乱,请问博主,知道这个问题吗?? 如果看到了,麻烦回复下哈,谢谢!

不能重复选择

点击相册,取消,再点击选择照片就没反应了,可以看看

只能拍照一次,这里在很多场景使用是逻辑不通的

如果我希望发送现拍的n张照片(比如朋友圈这种类似功能),按照demo中选中“选择照片(预览)”就行不通;建议在ZLPhotoActionSheet还加一行“确定”做相关处理或者在选中的照片不为零时将“取消”按钮变成“拍照”入口

取消选择所有图片后,点击确定还是有一张图片。

为什么取消选择所有图片,点击确定后还是会有一张图片?我试过QQ空间的图片上传功能,跟你的框架处理流程类似,也是取消所有选择,或者没有选择的时候,点击确定后,也会附带一张图片。
这段代码里面为什么一定要强行增加一张图片呢?不可以传一个空数组回去吗?

  • (void)btnDone_Click:(UIButton *)btn
    {
    if (self.arraySelectPhotos.count == 0) {
    PHAsset *asset = _arrayDataSources[_currentPage-1];
    if (![[ZLPhotoTool sharePhotoTool] judgeAssetisInLocalAblum:asset]) {
    ShowToastLong(@"图片加载中,请稍后");
    return;
    }
    ZLSelectPhotoModel *model = [[ZLSelectPhotoModel alloc] init];
    model.asset = asset;
    model.localIdentifier = asset.localIdentifier;
    [_arraySelectPhotos addObject:model];
    }
    if (self.btnDoneBlock) {
    self.btnDoneBlock(self.arraySelectPhotos, self.isSelectOriginalPhoto);
    }
    }

选中照片的问题

请问,我选择好照片,然后忘记选某张照片了,再重新返回的时候之前选择的照片又要重新选择了,这个时候能优化一下

iPad 不支持

在 iPad 下模拟器测试,点击选择照片,无法弹出视图,我查了已经获取到了图片,无法弹出选择图片的视图.

帮忙看一下问题

你好,最近集成了您的框架. 但是选择一张图片可以,但是多张为什么不行了呢?,一直显示正在处理,您的demo里面也是这种情况.

iPad 显示问题

在iPad中,选择相册的话,显示不了图片,只在界面上显示具体有几张图片,但是图片的缩略图没有,但是可以点击选中,只是一片空白

真机IOS8 8.4系统下会遇到问题

具体是调用系统相机拍照时:
走到saveImageToAblum:(UIImage *)image completion:(void (^)(BOOL, PHAsset *))completion这个方法:
__block NSString *assetId = nil;
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
assetId = [PHAssetCreationRequest creationRequestForAssetFromImage:image].placeholderForCreatedAsset.localIdentifier;
} completionHandler:^(BOOL success, NSError * _Nullable error) {
if (!success) {
if (completion) completion(NO, nil);
return;
}
//assetId为nil 导致后面的代码报错
PHAsset *asset = [PHAsset fetchAssetsWithLocalIdentifiers:@[assetId] options:nil].lastObject;

内存问题

  • (IBAction)btnSelectPhotoPreview:(id)sender 通过这个弹出的内存泄漏问题很大,反复点击内存一直不释放

  • (void)hide
    {
    if (self.animate) {
    CGPoint fromPoint = self.baseView.layer.position;
    CGPoint toPoint = CGPointMake(fromPoint.x, fromPoint.y+kBaseViewHeight);
    CABasicAnimation *animation = GetPositionAnimation([NSValue valueWithCGPoint:fromPoint], [NSValue valueWithCGPoint:toPoint], 0.1, @"position");
    animation.delegate = self;

      [self.baseView.layer addAnimation:animation forKey:nil];
    

    } else {
    self.hidden = YES;
    [self removeFromSuperview];
    }
    if (self.senderTabBarIsShow) {
    self.sender.tabBarController.tabBar.hidden = NO;
    }
    }

动画可以改掉,内存会好一点,可能是animation.delegate = self;造成了一部分内存问题

图片浏览器卡顿

我发现当push到ZLShowBigImgViewController的时候,如果加载的图片过大就会出现卡顿,加载截图之类的小图片就不会出现卡顿,往楼主解决,另外楼主pop时候设置的clearcolor 我感觉可以用 self.view.clipsToBounds = YES;这个来代替就没有问题了,希望楼主可以解决这个问题

崩溃

当相册没有图片的时候会崩溃

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.