All Projects â†’ rallahaseh â†’ RAImagePicker

rallahaseh / RAImagePicker

Licence: MIT license
📸 iMessage-like, Image Picker Controller Provides custom features.

Programming Languages

swift
15916 projects
shell
77523 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to RAImagePicker

MediaSliderView
Pure java based, highly customizable media slider gallery supporting both images and videos for android.
Stars: ✭ 85 (+507.14%)
Mutual labels:  images, videos
gettyimages-api nodejs
Getty Images API SDK for Node.js
Stars: ✭ 17 (+21.43%)
Mutual labels:  images, videos
android-doc-picker
A simple and easy to use documents Picker android library. Choose any documents like pdf, ppt, text, word or media files from your device
Stars: ✭ 37 (+164.29%)
Mutual labels:  images, videos
Vanilla Lazyload
LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
Stars: ✭ 6,596 (+47014.29%)
Mutual labels:  images, videos
Exiftool Vendored.js
Fast, cross-platform Node.js access to ExifTool
Stars: ✭ 200 (+1328.57%)
Mutual labels:  images, videos
Assetchecker
👮Sanitize your Assets.xcassets files
Stars: ✭ 167 (+1092.86%)
Mutual labels:  assets, images
Lassi-Android
All in 1 picker library for android.
Stars: ✭ 108 (+671.43%)
Mutual labels:  images, videos
Contentmanager
Android library for getting photo or video from a device gallery, cloud or camera. Working with samsung devices. Made by Stfalcon
Stars: ✭ 108 (+671.43%)
Mutual labels:  images, videos
Awesomeimagepicker
Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.
Stars: ✭ 160 (+1042.86%)
Mutual labels:  images, imagepicker
Awesome Deepfakes Materials
A curated list of awesome Deepfakes materials
Stars: ✭ 219 (+1464.29%)
Mutual labels:  images, videos
cloudinary-api
Shorter and lighter APIs for Cloudinary
Stars: ✭ 41 (+192.86%)
Mutual labels:  images, videos
nasa-images
product like nasa images gallery using react - redux
Stars: ✭ 17 (+21.43%)
Mutual labels:  images
SSImagePicker
Easy to use and configurable library to Pick an image from the Gallery or Capture an image using a Camera... 📸
Stars: ✭ 227 (+1521.43%)
Mutual labels:  imagepicker
react-butterfiles
🦋 Component for building file fields - from basic file inputs to drag and drop image galleries.
Stars: ✭ 44 (+214.29%)
Mutual labels:  images
ryuanime
A free anime streaming , using the jkanime content by scraping the jkanime website.
Stars: ✭ 20 (+42.86%)
Mutual labels:  videos
photos
"Fx Fotos" is an opensource gallery app in react native with the same smoothness and features of Google Photos and Apple Photos. It is backend gnostic and connects to decentralized backends like "box", "Dfinity", "Filecoin" and "Crust".
Stars: ✭ 620 (+4328.57%)
Mutual labels:  videos
phoenix assets webpack
Asset Pipeline with Webpack on Phoenix
Stars: ✭ 52 (+271.43%)
Mutual labels:  assets
avif-sample-images
AVIF example images, licensed under CC-BY-SA.
Stars: ✭ 37 (+164.29%)
Mutual labels:  images
clojure-must-watch
Must watch videos about Clojure in the same vein as js-must-watch (https://github.com/bolshchikov/js-must-watch).
Stars: ✭ 11 (-21.43%)
Mutual labels:  videos
Generative-Art
A selection of generative art scripts written in Python
Stars: ✭ 284 (+1928.57%)
Mutual labels:  images

RAImagePicker

CI Status Version License Platform

Description

RAImagePicker is a protocol-oriented framework that provides custom features from the built-in Image Picker Edit.



Overview

Object RAImagePickerController manages user interactions and delivers the results of those interactions to a delegate object.

RAImagePickerController depend on the configuration you set up before presenting it.

Functional Parts:

  1. Action Items(Default Asset.) - Supports two actions, this section is optional and by default contains action item for camera and photos.
  2. Camera - Camera's output(Capture Videos/Photos), this section is optinal and by default it's turned on.
  3. Asset. - Thumbnails of assets found in gallery, this section is mandatory and and can not be turned off.

Protocol Provide a delegate that conforms to RAImagePickerControllerDelegate protocol. Use delegate to get informed when user takes a picture or selects an asset from library and configure custom action and asset collection view cells.

Usage

Follow the following steps to get started:

  1. Add permissions to your info.plist file.
  2. Create new instance of RAImagePickerController.
  3. Present the controller Note: You can configure the controller by set Custom Cells, change Appearance and Layout and the Capture Mode

Features

  • Presentation Design Handeled for .horizontal(like iMessage) and .vertical Modes
  • Portrait and Landscape Supported
  • Support iPhone X
  • Support Live Photos
  • Flip Camera (Rear/Front)
  • Highly and Easly Customisable Layout

Plist Privacy Permissions

In order to get access to the user Camera and Photos/Videos Gallery, you will need to add permissions to the plist file :

  • Privacy - Camera Usage Description (Photos/Videos)
  • Privacy - Photo Library Usage Description (Gallery)
  • Privacy - Microphone Usage Description (Videos)
<key>NSCameraUsageDescription</key>
<string>Access Description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Access Description</string>
<key>NSMicrophoneUsageDescription</key>
<string>Access Description</string>

Capture Modes

Currently it supports capturing Photos, Live Photos and Videos.

To configure RAImagePicker to support desired media type use captureSettings struct. Use property cameraMode to specify what kind of output you are interested in.

  • photo [Support Photos Only (Default)]
  • video [Support Videos Only]
  • photoAndLivePhoto [Support Photos & Live Photos]
  • photoAndVideo [Support Videos & Photos]

Example:

let imagePicker = RAImagePickerController()
imagePicker.captureSettings.cameraMode = .photoAndLivePhoto

To save the captured photos to the gallery. Set the flag savesCapturedPhotosToPhotoLibrary to true.


Example:

let imagePicker = RAImagePickerController()
imagePicker.captureSettings.savesCapturedPhotosToPhotoLibrary = true

Fetching

Default Image Picker fetches from Photo Library 1000 photos and videos from smart album smartAlbumUserLibrary that should represent Camera Roll album. If you wish to provide your own fetch result please implement image picker controller's assetsFetchResultBlock block.

For example the following code snippet can fetch only live photos:

let imagePicker = RAImagePickerController()
imagePicker.assetsFetchResultBlock = {
    guard let livePhotosCollection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumLivePhotos, options: nil).firstObject else {
        return nil //you can return nil if you did not find desired fetch result, default fetch result will be used.
    }
    return PHAsset.fetchAssets(in: livePhotosCollection, options: nil)
}

Reference Photos Framework.

Customization



Action Cells

  1. Set Layout Configuration
let imagePicker = RAImagePickerController()
imagePicker.layoutConfiguration.showsDefaultCameraItem  = true
imagePicker.layoutConfiguration.showsDefaultGalleryItem = true
  1. Register Action Cells Now there's multiple ways to register your custom cells
  • Using nib
imagePicker.registerNibForActionItems(CustomNib) 
  • Using class
imagePicker.registerCellClassForActionItems(CustomCell) 
  • For specific item(nib)
imagePicker.cellRegistrator.register(nib: CustomNib, forActionItemAt: 0) 
  • For specific item(class)
imagePicker.cellRegistrator.register(nib: CustomCell, forActionItemAt: 0) 
  1. Configure Delegate
func imagePicker(controller: RAImagePickerController, willDisplayActionItem cell: UICollectionViewCell, at index: Int) {
    switch cell {
    case let customCell as CustomCell:
        switch index {
        case 0:
            customCell.title.text = "Title"
            customCell.icon.image = UIImage(named: "icon_name")
        case 1:
            customCell.title.text = "Title"
            customCell.icon.image = UIImage(named: "icon_name")
        default: break
        }
    default:
        break
    }
}
  1. Handle Selected Assets
func imagePicker(controller: RAImagePickerController, didSelectActionItemAt index: Int) {
    print("Selected Asset. Index: \(index)")
}

Appearance Cells

  1. Register Cell Classes
let imagePicker = RAImagePickerController()
imagePicker.register(cellClass: CustomImageCell.self, forAssetItemOf: .image)
imagePicker.register(cellClass: CustomVideoCell.self, forAssetItemOf: .video)

Please note, that RACellRegistrator provides a method to register one cell or nib for any asset media type.

  1. Configure Delegate
func imagePicker(controller: RAImagePickerController, willDisplayAssetItem cell: RAImagePickerAssetCell, asset: PHAsset) {
    switch cell {
    case let imageCell as CustomImageCell:
        if asset.mediaSubtypes.contains(.photoLive) {
            imageCell.subtypeImageView.image = UIImage(named: "icon_name")
        }
        else if asset.mediaSubtypes.contains(.photoPanorama) {
            imageCell.subtypeImageView.image = UIImage(named: "icon_name")
        }
        else if #available(iOS 10.2, *), asset.mediaSubtypes.contains(.photoDepthEffect) {
            imageCell.subtypeImageView.image = UIImage(named: "icon_name")
        }
        // etc ...
    case let videoCell as CustomVideoCell:
        videoCell.label.text = asset.duration
    default:
        break
    }
}

Presentation

let imagePicker = RAImagePickerController()
navigationController.present(imagePicker, animated: true, completion: nil)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

References

Requirements

  • Xcode +9.0
  • iOS 10.0+
  • Swift 4

Installation

RAImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'RAImagePicker'

Author

rallahaseh, [email protected]

License

RAImagePicker is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].