Giter Site home page Giter Site logo

yummypets / ypimagepicker Goto Github PK

View Code? Open in Web Editor NEW
4.2K 67.0 964.0 524.34 MB

๐Ÿ“ธ Instagram-like image picker & filters for iOS

License: MIT License

Ruby 0.37% Objective-C 0.17% Swift 99.46%
imagepicker picker photo video swift ios filter instagram gallery picture

ypimagepicker's People

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

ypimagepicker's Issues

Crashes (and black square) when Photo Library permission is denied

When I open the picker for the first time it asks me for permissions. If I deny the first request (Photo Library), then allow the second (Camera usage) and then deny the third one (Microphone) then, at first, it shows a black square instead of a camera preview (although the camera permission was granted). If I switch to the photo library picker (which is unaccessible due to denied permission and it's ok) and then switch again to the camera preview it shows normally.
And then, if I took a photo, it'll crash with this message:

This application is not allowed to access Photo data.

It happens even when the shouldSaveNewPicturesToAlbum is set to false

The full crash stack trace:

[Generic] *** This application is not allowed to access Photo data. (
0 PhotoLibraryServices 0x000000018fad5f38 + 1096
1 Photos 0x000000019091b63c + 84
2 Photos 0x00000001908ec664 + 128
3 Photos 0x0000000190903834 + 196
4 YPImagePicker 0x0000000106247c28 _T013YPImagePicker9FSAlbumVCCfETo + 176
5 libobjc.A.dylib 0x0000000181822ef4 + 148
6 libobjc.A.dylib 0x0000000181830638 objc_destructInstance + 88
7 libobjc.A.dylib 0x0000000181830690 object_dispose + 16
8 UIKit 0x000000018bad78f4 + 156
9 UIKit 0x000000018b88de7c + 1776
10 YPImagePicker 0x0000000106247b30 _T013YPImagePicker9FSAlbumVCCfD + 220
11 YPImagePicker 0x0000000106247b68 _T013YPImagePicker9FSAlbumVCCfDTo + 40
12 libswiftCore.dylib 0x00000001066a9798 _ZN5swift12metadataimpl14ValueWitnessesINS0_17ObjCRetainableBoxEE12destroyArrayEPNS_11OpaqueValueEmPKNS_14TargetMetadataINS_9InProcessEEE + 36
13 libswiftCore.dylib 0x000000010643aa7c _T0s23_ContiguousArrayStorageCfD + 60
14 libswiftCore.dylib 0x00000001066a7280 _swift_release_dealloc + 28
15 YPImagePicker 0x000000010626a648 _T013YPImagePicker13FSBottomPagerCfETo + 80
16 libobjc.A.dylib 0x0000000181822ef4 + 148
17 libobjc.A.dylib 0x0000000181830638 objc_destructInstance + 88
18 libobjc.A.dylib 0x0000000181830690 object_dispose + 16
19 UIKit 0x000000018bad78f4 + 156
20 UIKit 0x000000018b88de7c + 1776
21 YPImagePicker 0x00000001062a1c50 _T013YPImagePickerAACfETo + 120
22 libobjc.A.dylib 0x0000000181822ef4 + 148
23 libobjc.A.dylib 0x0000000181830638 objc_destructInstance + 88
24 libobjc.A.dylib 0x0000000181830690 object_dispose + 16
25 UIKit 0x000000018bad78f4 + 156
26 UIKit 0x000000018b88de7c + 1776
27 UIKit 0x000000018b8987e4 + 488
28 UIKit 0x000000018ba6b730 + 372
29 libobjc.A.dylib 0x0000000181822ef4 + 148
30 libobjc.A.dylib 0x0000000181830638 objc_destructInstance + 88
31 libobjc.A.dylib 0x0000000181830690 object_dispose + 16
32 UIKit 0x000000018ba66f1c + 64
33 UIKit 0x000000018c2abcc4 + 64
34 UIKit 0x000000018ba66ba8 + 24
35 libsystem_blocks.dylib 0x0000000181d35a60 _Block_release + 160
36 UIKit 0x000000018c39dbec + 116
37 libobjc.A.dylib 0x0000000181822ef4 + 148
38 libobjc.A.dylib 0x0000000181830638 objc_destructInstance + 88
39 libobjc.A.dylib 0x0000000181830690 object_dispose + 16
40 UIKit 0x000000018b833b90 + 64
41 UIKit 0x000000018b833b40 + 88
42 libobjc.A.dylib 0x0000000181822ef4 + 148
43 libobjc.A.dylib 0x0000000181830638 objc_destructInstance + 88
44 libobjc.A.dylib 0x0000000181830690 object_dispose + 16
45 UIKit 0x000000018b832334 + 1340
46 UIKit 0x000000018b831de4 + 120
47 UIKit 0x000000018b75770c + 312
48 UIKit 0x000000018b757418 + 296
49 UIKit 0x000000018b7574b8 + 456
50 QuartzCore 0x00000001862fbd6c + 284
51 libdispatch.dylib 0x0000000106f7145c _dispatch_client_callout + 16
52 libdispatch.dylib 0x0000000106f76050 _dispatch_main_queue_callback_4CF + 1192
53 CoreFoundation 0x00000001822b7f20 + 12
54 CoreFoundation 0x00000001822b5afc + 2012
55 CoreFoundation 0x00000001821d62d8 CFRunLoopRunSpecific + 436
56 GraphicsServices 0x0000000184067f84 GSEventRunModal + 100
57 UIKit 0x000000018b783880 UIApplicationMain + 208
58 myExample 0x0000000104eedd08 main + 76
59 libdyld.dylib 0x0000000181cfa56c + 4
)

Crashes When permissions denied

Crashes happen when people denied photo/video access and tap Photo taking related buttons (flash/ shot, focus etc)

  • If permission is denied -> show a popup with a link to grant access in the settings
  • If user taps a restricted button -> show the popup again

it will crash when run on a real iPhone

I have set 'Privacy - Photo Library Usage Description' and 'This lets you take photos and record video.'And let it run on iPhone 6plus, when present the picker, it will crash.On the simulatorm, it crashs at ' videoInput = try? AVCaptureDeviceInput(device: aDevice)'

Getting an error : Type 'UILayoutPriority' (aka 'Float') has no member 'defaultHigh'

public func constraint(item view1: AnyObject,
attribute attr1: NSLayoutAttribute,
relatedBy: NSLayoutRelation = .equal,
toItem view2: AnyObject? = nil,
attribute attr2: NSLayoutAttribute? = nil, // Not an attribute??
multiplier: CGFloat = 1,
constant: CGFloat = 0) -> NSLayoutConstraint {
let c = NSLayoutConstraint(item: view1, attribute: attr1,
relatedBy: relatedBy,
toItem: view2, attribute: ((attr2 == nil) ? attr1 : attr2! ),
multiplier: multiplier, constant: constant)
c.priority = UILayoutPriority(rawValue: UILayoutPriority.defaultHigh.rawValue + 1)
return c
}

Fatal Exception: NSInternalInconsistencyException

  1. Open YPImagePicker. Library mode;
  2. Switch to an another app;
  3. Save some image to the library.
  4. Switch back to the app. Crash!
    @s4cha

Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (209) must be equal to the number of items contained in that section before the update (209), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x181343164 __exceptionPreprocess
1  libobjc.A.dylib                0x18058c528 objc_exception_throw
2  CoreFoundation                 0x181343038 +[NSException raise:format:]
3  Foundation                     0x181cdd7f4 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  UIKit                          0x18b399760 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:]
5  UIKit                          0x18b39d250 -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:]
6  UIKit                          0x18b39d534 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:]
7  UIKit                          0x18b39d390 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:]
8  UIKit                          0x18b39d314 -[UICollectionView _performBatchUpdates:completion:invalidationContext:]
9  UIKit                          0x18aab921c -[UICollectionView performBatchUpdates:completion:]
10 YPImagePicker                  0x100d044f8 (Missing)
11 YPImagePicker                  0x100d0419c (Missing)
12 YPImagePicker                  0x100cf28c4 (Missing)
13 libdispatch.dylib              0x180cc2a54 _dispatch_call_block_and_release
14 libdispatch.dylib              0x180cc2a14 _dispatch_client_callout
15 libdispatch.dylib              0x180ccf698 _dispatch_main_queue_callback_4CF$VARIANT$mp
16 CoreFoundation                 0x1812eb344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
17 CoreFoundation                 0x1812e8f20 __CFRunLoopRun
18 CoreFoundation                 0x181208c58 CFRunLoopRunSpecific
19 GraphicsServices               0x1830b4f84 GSEventRunModal
20 UIKit                          0x18a9615c4 UIApplicationMain

White Bar offset in Library

When the camera starts first and then you change to the library, there is a white bar ontop of the first row of library images (roughly 40pt). It goes away if you scroll down.

photo from gallery

when pick photo from gallery quality reduce and photo resolution down

make library option to open first

When we are creating object of YPImagePicker and present it as view controller I need to open Library option first insted of Photo. How to do that? Thanks.

Run time error

When run the git project it shows,

Module compiled with Swift 4.0.3 cannot be imported in Swift 4.0: /Users/Aneena/Downloads/YPImagePicker-master 2/Carthage/Build/iOS/Stevia.framework/Modules/Stevia.swiftmodule/x86_64.swiftmodule

ETA for Multiple Image selection?

First of all, Thank You!! for your great work.

I was wondering if you have in your future improvements the multiple image selection?? Or even if there is a way that I can help with it, in my spare time ๐Ÿ˜„

Thanks!

cc @s4cha

Warnings

let imageOutput = AVCaptureStillImageOutput()
2018-03-06 22 01 21
let data = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(buffer!)
'AVCaptureStillImageOutput' was deprecated in iOS 10.0: Use AVCapturePhotoOutput instead
v.flashButton.setImage(flashImage(forAVCaptureFlashMode: device.flashMode), for: .normal)
'flashMode' was deprecated in iOS 10.0: Use AVCapturePhotoSettings.flashMode instead.

Crash after delete image from photo library

iOS 11.2.x
iPhone X

Hey guys, I found this issue. If you are in library section in YPImagePicker and go to native photo library of the device and delete an image, the app crash when you come back to it.

Not Working for swift 3

your code is not updated for version 1.2.1 and also there is no Edit option like Instagram . Please update it for swift3 and multiple image selection is not working.

Camera takes long time to open

I've updated the code to the 2.6.1 build but have noticed that the camera will take 7-10 seconds to open and sometimes will not open at all. I'm testing on an iPhone 6s, iOS 11.2.5.

Provide a way to customize wordings

Hi,
I cannot see any option for chaning the button titles. They are called:
"Ypimagepickerlibrary", "Ypimagepickerphoto", ... and in the navigation bar "YPimagePickerNext".

More detailed install description?

Hey! As someone fairly new to Swift, i have a trouble installing this library. Could anyone please help me out? (Preferably through cocoapods!)

Slo-mo video recorded

Endless loading on attempt to load a slo-mo video recorded using native camera app

Display only gallery option in picker

Currently in the SDK we've default options as either we can select images/videos from library or we can take it using camera. But it would be useful if SDK provides options so we can set only option from (library or photos or videos) for media selection.

Navigating with 'Next' and 'Done' buttons

Apologies beforehand as this is probably a dumb question with a simple solution.

Can you point me in the right direction for getting the selected photo and navigating to another VC by clicking on the 'Next' or 'Done' button? The best case scenario is the transition looks the same as the transition from initial image picker to the filter page.

I would also want the image to carry over to the other VC.

Thanks for any information you may have.

videos picking is not working

There,
i was having an issue while using your library, nothing happens when it comes to videos neither in the video capturing tab nor when we select a video from the photo album.
it starts the video capturing but on the stop button the video just gets vanished away and nothing significant happens, technically it should take the video to the filter view and then to the main view like instagram.
can you please look into this and help me out ?
thanks

Saving Videos taken

It would be great to enable saving in the library the videos taken by the picker.

Video not squared when playing it back.

With the configuration below, after recording the video it's not saved as squared. When playing it back in an AVPlayerLayer it's in portrait mode.

Configuration:

var config = YPImagePickerConfiguration()
config.onlySquareImagesFromLibrary = true
config.onlySquareImagesFromCamera = true
config.showsVideo = true
config.showsFilters = false
config.videoCompression = AVAssetExportPresetPassthrough
config.libraryTargetImageSize = .cappedTo(size: mediaSize)
let picker = YPImagePicker(configuration: config)

Memory increases for each use

Before starting the YPImagePicker from my app, I'm around 40MB of used memory (real device).

  • After starting the picker/camera the memory goes up a couple of MBs.
    When I dismiss the picker, the used memory is still at the increased amount.
  • After using filters, the memory goes up around 50MB more.
    When I dismiss the picker, the used memory is still at around 150MB.

So, after opening, using some filters, dismissing a couple of times, the used memory is easily at 500MB.

Can you please look at this?

camera issue

Now that I've used the library, where's the button to take a picture on the camera screen?

libraryVC title don't modify when change album

YPPickerVC.swift

    func navBarTapped() {
        
        let vc = YPAlbumVC()
        vc.noVideos = !self.configuration.showsVideoInLibrary
        let navVC = UINavigationController(rootViewController: vc)

        vc.didSelectAlbum = { [weak self] album in
            self?.libraryVC?.setAlbum(album)
            self?.libraryVC?.title = album.title   //add this code to fixed issue
            self?.libraryVC?.refreshMediaRequest()
            self?.setTitleViewWithTitle(aTitle: album.title)
            self?.dismiss(animated: true, completion: nil)
        }
        present(navVC, animated: true, completion: nil)
    }

custom crop template

Hello there, first of all i love your work. it's awesome and easy to customize. i want to create a custom rectangular (2:1 aspect ratio) crop area for certain use cases. (such as cover photos) can you implement such a feature maybe something like:
config.customCrop = true
config.cropRectangleRatio(width:1,height:2)
and maybe something like
config.cropCircle = true

can you walk me through or what is your opinion on the matter?

Additions and changes in LIB (Discussion)

I've created this issue in order to tell what i did updated for my project. And maybe something of this could be extracted to the public api.

Strings:

  • All ypLocalized strings.

Images:

  • arrow.image = imageFromBundle("arrow_down_dotted")
  • videoStartImage = imageFromBundle("record")
  • videoStopImage = imageFromBundle("record_on")
  • v.flipButton.setImage(imageFromBundle("rotate"), for: .normal)

Different:

  • alignHorizontally(label-arrow)
  • Camera buttons layout (but this is specail case)
  • Don't hide status bar
  • Color of the selected items (multiple selection image and in right top corner)

Why NSMicrophoneUsageDescription?


        var config = YPImagePickerConfiguration()
        config.screens = [.library, .photo]
        let picker = YPImagePicker(configuration: config)

        picker.didSelectImage = { [unowned picker] img in

        }

Is there a way to avoid asking the permission (NSMicrophoneUsageDescription)? The lib should allow to pick images only
@s4cha

Slow to display camera.

It takes around 7-8 seconds for the camera to display its content after displaying the YTImagePicker, I'm using the default configuration.

let picker = YPImagePicker()
picker.didSelectImage = { [unowned picker] img in
  self.imageView.image = img
  picker.dismiss(animated: true, completion: nil)
}
picker.didSelectVideo = { [unowned picker] videoData, videoThumbnailImage in
  self.imageView.image = videoThumbnailImage
  picker.dismiss(animated: true, completion: nil)
}
present(picker, animated: true, completion: nil)

Preview:
https://imgur.com/a/3HktU

Devices: iPhone X, iPhone 7+
iOS: 11.2.5

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.