Coder Social home page Coder Social logo

gatherdigital / czphotopickercontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from napazone/czphotopickercontroller

0.0 8.0 0.0 1.27 MB

A photo picker offering 'use last photo taken', 'take photo', and 'choose from library'

License: Apache License 2.0

Ruby 7.98% Objective-C 83.28% C 1.55% Shell 7.19%

czphotopickercontroller's Introduction

CZPhotoPickerController

CZPhotoPickerController simplifies picking, taking, or using the last photo.

It presents a UIActionSheet with the appropriate options for the device, taking into account photo library permissions and whether or not the device has a camera, and then presents a UIImagePickerController (when picking an existing photo or taking a new one) or returns the last photo taken.

It supports the iPhone and iPad.

Installation

pod 'CZPhotoPickerController'

##Usage:

__weak typeof(self) weakSelf = self;

self.photoPicker = [[CZPhotoPickerController alloc] initWithPresentingViewController:self withCompletionBlock:^(UIImagePickerController *imagePickerController, NSDictionary *imageInfoDict) {

  if (imagePickerController.allowsEditing) {
    weakSelf.imageView.image = imageInfoDict[UIImagePickerControllerEditedImage];
  }
  else {
    weakSelf.imageView.image = imageInfoDict[UIImagePickerControllerOriginalImage];
  }

  [weakSelf.photoPicker dismissAnimated:YES];
  weakSelf.photoPicker = nil;

}];

self.photoPicker.allowsEditing = YES; // optional

self.photoPicker.cropOverlaySize = CGSizeMake(320, 160); // optional

[self.photoPicker showFromBarButtonItem:btn];

If allowsEditing is YES, the user will be asked to resize the chosen image. Otherwise, a preview is shown.

If cropOverlaySize is set, the picker will crop the image to the aspect ratio of cropOverlaySize and the preview screen will highlight the cropped area. We'd love a pull request to support pinch and zoom too!

Screenshots

Action sheet

Allows editing

Contributing

Our uncrustify config is in ./config along with a shell script that will uncrustify the files in ./CZPhotoPickerController/. It requires uncrustify 0.60 which is available via homebrew with brew update && brew install uncrustify. Please run ./config/uncrustify.sh to clean up whitespace. Thank you!

Credits

CZPhotoPickerController was created by Brian Cooke and Peyman Oreizy in the development of CareZone Mobile for iOS.

Contact

Brian Cooke @bricooke

Peyman Oreizy @peymano

License

CZPhotoPickerController is available under the Apache 2.0 license. See the LICENSE file for more info.

czphotopickercontroller's People

Contributors

chrisze avatar guillaumealgis avatar hyperspacemark avatar mattkennedy avatar peymano avatar seivan avatar yas375 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.