Giter Club home page Giter Club logo

pesdk-cordova-demo's Introduction

PhotoEditor SDK Logo

PhotoEditor SDK Cordova Plugin Demo

This project shows how to easily integrate the PhotoEditor SDK into a Cordova application.

THIS IS A DEMO. This repository is not meant as a fully fledged Cordova plugin, but as a base for further development instead. You can copy the repository into your own project and use the cordova plugin add /path/to/plugin --link command to add it to your app. You will most likely need to adjust the codebase to fit your requirements and to customize the PhotoEditor SDK. For customizations, take a look at the PESDKPlugin.m and PESDKPlugin.java files. You can easily alter the configurations to change colors, behaviour etc. and handle callbacks that are sent by our SDK. For further reference take a look at our documentation.

⚠️ The latest iOS SDK needs to be downloaded manually from our repository and placed in the /src/ios/ directory.

License Files

⚠️ The SDK requires dedicated license files for each platform. If unavailable, the camera and editor will crash upon launch.

You need to add the LICENSE_IOS and LICENSE_ANDROID files to each project. This can be done manually by opening the PESDKDemo.xcworkspace using Xcode and dragging the license file into the sidebar, as well as copying the license file to the /platforms/android/app/main/assets folder for Android.

Or automated by using Cordovas resource-file tags to link the files from the root directory. To do so, put your LICENSE_ANDROID and LICENSE_IOS files in the root folder of your project and then add the following lines to your config.xml:

Within the Android platform tag (supported starting cordova-android-7.0):

<platform name="android">
  <resource-file src="LICENSE_ANDROID" target="app/src/main/assets/LICENSE_ANDROID" />
</platform>

Within the iOS platform tag:

<platform name="ios">
  <resource-file src="LICENSE_IOS" />
</platform>

⚠️ You need to make sure that the app identifiers declared in your license files match the bundle/app identifiers used on iOS and Android.

Example App

The included example app demonstrates how to open the PhotoEditor SDK's camera and pass any taken or selected images to the editor. When an edited image is saved, its filepath is sent back to Cordova and displayed using a JavaScript alert. An app could then display this image in Cordova or send it to a backend. If you want to edit an already existing image, you just need to path a path to the file (keep the file handling methods on both platforms in mind). To launch the example app, take a look at the Development section below.

Note

The PhotoEditorSDK is a product of img.ly GmbH. Please order a license. Please see the included LICENSE for licensing details.

PhotoEditor SDK for iOS & Android

The PhotoEditor SDK for iOS and Android are fully customizable photo editors which you can integrate into your Cordova app within minutes.

Installation

In order to use the plugin within your Cordova app you need to provide license files for both platforms as mentioned above. Once these are linked correctly, you'll need to do a few more minor configurations:

iOS Configuration

Since iOS 10 it's mandatory to provide an usage description in the info.plist if trying to access privacy-sensitive data. These are required and not setting them will cause your app to crash.

This plugins requires the following usage descriptions:

  • NSCameraUsageDescription specifies the reason for your app to access the device's camera.
  • NSPhotoLibraryUsageDescription specifies the reason for your app to access the user's photo library.

To add these entries into the info.plist, you can use the edit-config tag in the config.xml like this:

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
    <string>Uses your camera to snap pictures.</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
    <string>Accesses your photo library to save and open pictures.</string>
</edit-config>

Android Configuration

As the Android SDK links different modules depending on your configuration, we're providing a Gradle plugin which needs to be added to your Android project. To prepare this, you'll have to add the following lines to your projects .gradle file (platforms/android/build.gradle):

buildscript {
    repositories {
        // ...
        maven { url "https://artifactory.9elements.com/artifactory/imgly" }
    }
    dependencies {
        // ...
        classpath 'ly.img.android.pesdk:plugin:6.2.7'
    }
}

allprojects {
    repositories {
        // ...
        maven { url "https://artifactory.9elements.com/artifactory/imgly" }
    }
    // ...
}

Development

The example app was created by starting a new Cordova app, adding the iOS and Android platforms and linking the plugin using the cordova plugin add /path/to/plugin --link command mentioned above.

To run the Android and iOS samples you can then simply execute cordova run android or cordova run ios from the example subfolder.

If you make changes to the plugin in the root directory, you'll likely have to remove and add the plugin to your example project again to make sure the updated source code is used.

License

Please see LICENSE for licensing details.

Authors and Contributors

Made 2013-2019 by img.ly

Support or Contact

Use our service desk for bug reports or support requests. To request a commercial license, please use the license request form on our website.

pesdk-cordova-demo's People

Contributors

schiewe avatar toniha93 avatar maltebaumann avatar davidgv88 avatar npriddat avatar phoenixraw avatar sascha avatar svendvd 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.