GithubHelp home page GithubHelp logo

ezphotopicker's Introduction

EZPhotoPicker

If you want to pick up a photo from the gallery and camera, store it somewhere then do something, this library will be the best choice for you. It will handle all the storing, scaling, rotating, threading, loading dialog. Easy to start a photo intent, easy to get the result, you won't need to code a lot as what you used to do.

It also help you to handle about realtime permission without any lines of code.

Try it, you will see what I mean.

Intergrating gradle

Add this to your module's build.gradle

repositories {
    mavenCentral()
    maven {
        url 'https://dl.bintray.com/siclo/SicloAndroidOSS'
    }
}
compile 'com.siclo.ezphotopick:library:1.0.10'

Usage

For full example, please refer to sample

Start image picker activity

EZPhotoPickConfig config = new EZPhotoPickConfig();
config.photoSource = PhotoSource.GALLERY; // or PhotoSource.CAMERA
config.isAllowMultipleSelect = true; // only for GALLERY pick and API >18
config.maxExportingSize = 1000;
EZPhotoPick.startPhotoPickActivity(MainActivity.this, config);

For more configurations, check EZPhotoPickConfig class

Receive result onActivityResult

For simplest way, load and use the bitmap, and dont care about the photo name/path:
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode != RESULT_OK) {
            return;
        }

        if (requestCode == EZPhotoPick.PHOTO_PICK_GALLERY_REQUEST_CODE || requestCode == EZPhotoPick.PHOTO_PICK_CAMERA_REQUEST_CODE) {
              Bitmap pickedPhoto = new EZPhotoPickStorage(this).loadLatestStoredPhotoBitmap();
              //do something with the bitmap
        }
    }
Or you need the photo name
    String photoName = data.getStringExtra(EZPhotoPick.PICKED_PHOTO_NAME_KEY);
    Bitmap pickedPhoto = ezPhotoPickStorage.loadStoredPhotoBitmap(photoDir, photoName, 300);
Or you need the absolute stored photo path for doing something
    String photoName = data.getStringExtra(EZPhotoPick.PICKED_PHOTO_NAME_KEY);
    String photoPath = ezPhotoPickStorage.getAbsolutePathOfStoredPhoto(photoDir, photoName);
    //do something with the path
Or multiple photos (Only for gallery pick)
    ArrayList<String> pickedPhotoNames = data.getStringArrayListExtra(EZPhotoPick.PICKED_PHOTO_NAMES_KEY);
    for(String photoName: photoNames){
       Bitmap pickedPhoto = ezPhotoPickStorage.loadStoredPhotoBitmap(photoDir, photoName, 300);
    }

For more public api for the storage, check EZPhotoPickStorage class

Contribution

Questions

If you have any questions regarding EZPhotoPicker,create an Issue

Feature request, new features?

We are still working on it to add more useful option/feature, to create a new feature request, open an issue

I'll try to answer as soon as I find the time.

Pull requests welcome

Feel free to contribute to EZPhotoPicker.

Either you found a bug or have created a new and awesome feature, just create a pull request.

License

Copyright 2016 Siclo Mobile Vietnam

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

ezphotopicker's People

Contributors

ericta avatar khanhsiclo avatar comaxime 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.