├── .editorconfig
├── .github
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .jshintrc
├── .npmignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── docs
└── api.md
├── package.json
├── plugin.xml
├── spec
├── helper
│ └── cordova.js
└── index.spec.js
├── src
├── android
│ └── ImageEditor.java
└── ios
│ ├── CDVImageEditor.h
│ └── CDVImageEditor.m
└── www
└── ImageEditor.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | # This file is for unifying the coding style of different editors and IDEs.
2 | # editorconfig.org
3 |
4 | root = true
5 |
6 | [*]
7 | charset = utf-8
8 | end_of_line = lf
9 | indent_size = 4
10 | indent_style = space
11 | insert_final_newline = true
12 | trim_trailing_whitespace = true
13 |
14 | [*.json]
15 | indent_size = 2
16 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | We love pull requests from everyone. Read through this guide to learn how to contribute.
4 |
5 | _**Note:** This project only accepts pull requests related to open issues. If suggesting a new feature or change, please discuss it in an issue first._
6 |
7 | **Contents**
8 |
9 | - [Workflow](#workflow)
10 | - [Tools](#tools)
11 |
12 |
13 | ## Workflow
14 |
15 | Quick overview:
16 |
17 | 1. Forking and cloning
18 | 1. Using the npm scripts
19 | 1. Pushing your changes
20 | 1. Submitting a pull request
21 |
22 | ### 1. Forking and cloning
23 |
24 | [Fork](https://help.github.com/articles/fork-a-repo/), then [clone](https://help.github.com/articles/cloning-a-repository/) the repo:
25 |
26 | ```
27 | git clone git@github.com:your-username/phonegap-plugin-csdk-image-editor.git
28 | ```
29 |
30 | Set up a branch for your feature or bugfix with a link to the original repo:
31 |
32 | ```
33 | git checkout -b my-awesome-new-feature
34 | git push --set-upstream origin my-awesome-new-feature
35 | git remote add upstream https://github.com/CreativeSDK/phonegap-plugin-csdk-image-editor
36 | ```
37 |
38 |
39 | ### 2. Using the npm scripts
40 |
41 | Set up the project:
42 |
43 | ```
44 | npm install
45 | ```
46 |
47 | Make sure the tests pass before changing anything:
48 |
49 | ```
50 | npm test
51 | ```
52 |
53 | Make your change. Add tests for your change. Make the tests pass:
54 |
55 | ```
56 | npm test
57 | ```
58 |
59 | Add or edit [JSDoc](http://usejsdoc.org/) in the source code, then run:
60 |
61 | ```
62 | npm run build:docs
63 | ```
64 |
65 | You can check the JSDoc output in `docs/api.md`.
66 |
67 |
68 | ### 3. Pushing your changes
69 |
70 | Commit changes:
71 |
72 | ```
73 | git commit -m "Cool stuff"
74 | ```
75 |
76 | Make sure your branch is up to date with the original repo:
77 |
78 | ```
79 | git fetch upstream
80 | git merge upstream/master
81 | ```
82 |
83 | Review your changes and any possible conflicts and push to your fork:
84 |
85 | ```
86 | git push origin
87 | ```
88 |
89 | ### 4. Submitting a pull request
90 |
91 | [Read here about how to submit a pull request](https://help.github.com/articles/creating-a-pull-request/).
92 |
93 | At this point you're waiting on us. We do our best to keep on top of all the pull requests. We may suggest some changes, improvements or alternatives.
94 |
95 | Some things that will increase the chance that your pull request is accepted:
96 |
97 | - Write tests.
98 | - Write a [good commit message](http://chris.beams.io/posts/git-commit/).
99 | - Make sure the PR merges cleanly with the latest master.
100 | - Describe your feature/bugfix and why it's needed/important in the pull request description.
101 |
102 |
103 | ## Tools
104 |
105 | ### Editor Config
106 |
107 | The project uses [.editorconfig](http://editorconfig.org/) to define the coding
108 | style of each file. We recommend that you install the Editor Config extension
109 | for your preferred IDE. Consistency is key.
110 |
111 | ### JSHint
112 |
113 | The project uses [.jshint](http://jshint.com/docs) to define the JavaScript
114 | coding conventions. Most editors now have a JSHint add-on to provide on-save
115 | or on-edit linting.
116 |
117 | #### Install JSHint for vim
118 |
119 | 1. Install [jshint](https://www.npmjs.com/package/jshint).
120 | 1. Install [jshint.vim](https://github.com/wookiehangover/jshint.vim).
121 |
122 | #### Install JSHint for Sublime
123 |
124 | 1. Install [Package Control](https://packagecontrol.io/installation)
125 | 1. Restart Sublime
126 | 1. Type `CMD+SHIFT+P`
127 | 1. Type _Install Package_
128 | 1. Type _JSHint Gutter_
129 | 1. Sublime -> Preferences -> Package Settings -> JSHint Gutter
130 | 1. Set `lint_on_load` and `lint_on_save` to `true`
131 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Expected Behaviour
2 |
3 | ### Actual Behaviour
4 |
5 | ### Reproduce Scenario (including but not limited to)
6 |
7 | #### Steps to Reproduce
8 |
9 | #### Platform and Version (eg. Android 5.0 or iOS 9.2.1)
10 |
11 | #### (Android) What device vendor (e.g. Samsung, HTC, Sony...)
12 |
13 | #### PhoneGap CLI version and PhoneGap platform version
14 |
15 | phonegap --version # e.g. 6.0.0
16 | phonegap platform version android # e.g. 4.1.1
17 |
18 | #### Plugin version
19 |
20 | phonegap plugin version | grep phonegap-plugin-csdk-image-editor # e.g. 1.5.3
21 |
22 | #### Sample Code that illustrates the problem
23 |
24 | #### Logs taken while reproducing problem
25 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Description
4 |
5 |
6 | ## Related Issue
7 |
8 |
9 |
10 |
11 |
12 | ## Motivation and Context
13 |
14 |
15 | ## How Has This Been Tested?
16 |
17 |
18 |
19 |
20 | ## Screenshots (if appropriate):
21 |
22 | ## Types of changes
23 |
24 | - [ ] Bug fix (non-breaking change which fixes an issue)
25 | - [ ] New feature (non-breaking change which adds functionality)
26 | - [ ] Breaking change (fix or feature that would cause existing functionality to change)
27 |
28 | ## Checklist:
29 |
30 |
31 | - [ ] My code follows the code style of this project.
32 | - [ ] My change requires a change to the documentation.
33 | - [ ] I have updated the documentation accordingly.
34 | - [ ] I have read the **CONTRIBUTING** document.
35 | - [ ] I have added tests to cover my changes.
36 | - [ ] All new and existing tests passed.
37 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .idea
3 | .DS_Store
4 | /node_modules/
5 | src/ios/AdobeCreativeSDKFrameworks/*
6 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "asi": false,
3 | "boss": false,
4 | "camelcase": true,
5 | "curly": true,
6 | "eqeqeq": true,
7 | "eqnull": false,
8 | "es5": false,
9 | "evil": false,
10 | "expr": false,
11 | "forin": true,
12 | "funcscope": false,
13 | "jasmine": true,
14 | "immed": true,
15 | "indent": 4,
16 | "latedef": true,
17 | "loopfunc": false,
18 | "maxerr": 7,
19 | "newcap": true,
20 | "node": true,
21 | "nonew": true,
22 | "plusplus": false,
23 | "quotmark": "single",
24 | "shadow": false,
25 | "strict": false,
26 | "supernew": false,
27 | "trailing": true,
28 | "undef": true,
29 | "white": true
30 | }
31 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | spec/
2 | tests/
3 | src/ios/AdobeCreativeSDKFrameworks
4 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | ## [v1.0.0](https://github.com/* remote origin
4 | Fetch URL: https://github.com//tree/v1.0.0) (2016-07-09)
5 | [Full Changelog](https://github.com/* remote origin
6 | Fetch URL: https://github.com//compare/v0.0.2...v1.0.0)
7 |
8 | - 1.0.0 [view commit](http://github.com/* remote origin
9 | Fetch URL: https://github.com//commit/76f07f0da8d616c49d34fc3ebbf7e8ddbc32ceea)
10 | - Bumping plugin version to 1.0.0 [view commit](http://github.com/* remote origin
11 | Fetch URL: https://github.com//commit/64a7780a87a6aca8ddeeeab81213797fea5ae050)
12 | - Prepare for 1.0.0 release [view commit](http://github.com/* remote origin
13 | Fetch URL: https://github.com//commit/53d13675e45ee1807ab636d49cd6c0c95253ac1b)
14 | - Issue #17: Add tests for OrientationType, LeftButtonType & RightButtonType [view commit](http://github.com/* remote origin
15 | Fetch URL: https://github.com//commit/529d8e5ce4066df56a4a7088797d3931eda72e5b)
16 | - Specifying which options are platform-specific. (#18) [view commit](http://github.com/* remote origin
17 | Fetch URL: https://github.com//commit/f0b811a7496ceb58ce56f64eaa28994d0a398fa7)
18 | - Implement missing options on iOS [view commit](http://github.com/* remote origin
19 | Fetch URL: https://github.com//commit/c5dba1474d23c839dab6f6883488a53afd2e9039)
20 | - Remove unused confirmExit on iOS [view commit](http://github.com/* remote origin
21 | Fetch URL: https://github.com//commit/8fab73eaa5c461eb970e7865337c07e6895d1c03)
22 | - Added .github contribution guidelines. (#15) [view commit](http://github.com/* remote origin
23 | Fetch URL: https://github.com//commit/a542241965c77a111c4f4870f75d24e5d3f55fb7)
24 | - [whoops] lazy copy and paste error [view commit](http://github.com/* remote origin
25 | Fetch URL: https://github.com//commit/629dc11a46e83a0afd68baafbe9dc144f1cd0244)
26 | - [doc] outputFile option [view commit](http://github.com/* remote origin
27 | Fetch URL: https://github.com//commit/fb1b9e152e6345a2bb7f0db12455becf76aa16f3)
28 | - Implement missing options on Android (Part 2) [view commit](http://github.com/* remote origin
29 | Fetch URL: https://github.com//commit/21d6ff0d8ddf8bb0ee8f12fc64b961ddd97e8f2b)
30 | - Issue #11: Add npm script to export jsdoc2md docs [view commit](http://github.com/* remote origin
31 | Fetch URL: https://github.com//commit/211ff93dc7463080f56df9ab1ae1f34f0450f227)
32 | - Implement missing options on Android (#14) [view commit](http://github.com/* remote origin
33 | Fetch URL: https://github.com//commit/f14a231b0d8feb4da0e759081604b8e167f05cfe)
34 | - Merge pull request #13 from CreativeSDK/docs [view commit](http://github.com/* remote origin
35 | Fetch URL: https://github.com//commit/0772103cc2970526e23c970ecb9048e2197e27c7)
36 | - Adding details for options docs, and sample code for using the quality setting. [view commit](http://github.com/* remote origin
37 | Fetch URL: https://github.com//commit/5c070a33a8b8e7b24eee6878d01fcfcbd6d889d1)
38 | - Merge pull request #10 from CreativeSDK/docs [view commit](http://github.com/* remote origin
39 | Fetch URL: https://github.com//commit/18ef3be8629c93b6b262285ce1ee289cdcf4c118)
40 | - Added defaults docs to options object. [view commit](http://github.com/* remote origin
41 | Fetch URL: https://github.com//commit/dfc6cc7dff05fad4edc2e96f6534598dde1f6551)
42 | - Updated anchors for gfm. [view commit](http://github.com/* remote origin
43 | Fetch URL: https://github.com//commit/55eacf1799889ced5c572c51963e5d4896a7806a)
44 | - API docs output with jsdoc2md. [view commit](http://github.com/* remote origin
45 | Fetch URL: https://github.com//commit/73dee885b0f331ba459c910dfc57b0a4c519f2b4)
46 | - First attempt at JSDoc. [view commit](http://github.com/* remote origin
47 | Fetch URL: https://github.com//commit/35b0329da07f50a1b31639e6d4f2d7530b65ea7f)
48 | - Added manual API docs. [view commit](http://github.com/* remote origin
49 | Fetch URL: https://github.com//commit/1140059570d0024e1605a3a6110620fdb52e7271)
50 | - Issue #6: Check if is working as intended [view commit](http://github.com/* remote origin
51 | Fetch URL: https://github.com//commit/32c563c506c72cf53b87879155481955add1eb39)
52 | - Issue #7: Fix argcheck issue when running tests [view commit](http://github.com/* remote origin
53 | Fetch URL: https://github.com//commit/8c2310fcccfeb28343bd8837d7f4b346b4039c7c)
54 | - Adding documentation. API guide still needs to be added. [view commit](http://github.com/* remote origin
55 | Fetch URL: https://github.com//commit/e85e96396447584c20bfdd53577f39bc3626c3be)
56 | - Issue #8: Upgrade to CSDK 0.9.1062 [view commit](http://github.com/* remote origin
57 | Fetch URL: https://github.com//commit/ec0a9d380f27fbbbe63455498c8afe2ccfcfd600)
58 | - Issue #4: Rename to CSDKImageEditor [view commit](http://github.com/* remote origin
59 | Fetch URL: https://github.com//commit/c0a830fa182826510dbc9138276c7ca444001492)
60 | - Added Waffle badge. [view commit](http://github.com/* remote origin
61 | Fetch URL: https://github.com//commit/220b673a250b45e655613a9a208bfe1b693550ee)
62 | - Update plugin.xml [view commit](http://github.com/* remote origin
63 | Fetch URL: https://github.com//commit/b407561b799476f0dc046b3680fe84dddac7f09e)
64 | - If no tools are specified, show all tools [view commit](http://github.com/* remote origin
65 | Fetch URL: https://github.com//commit/998478d1821ce3751dc0ca9600b9b68fc763868b)
66 | - Add tool support to iOS [view commit](http://github.com/* remote origin
67 | Fetch URL: https://github.com//commit/6435669609cef76204e538d262c951f7734be3c3)
68 | - Use encoding and quality parameters on iOS [view commit](http://github.com/* remote origin
69 | Fetch URL: https://github.com//commit/7f8f7a3148c08ced9973acc20f9797e4123c90ef)
70 | - Write modified image to disk [view commit](http://github.com/* remote origin
71 | Fetch URL: https://github.com//commit/c7fe1152bb6e40b1de3724a413d7995372beb1b0)
72 | - Start on ImageEditor for iOS [view commit](http://github.com/* remote origin
73 | Fetch URL: https://github.com//commit/b07bc28fae69af95f4f5d2cba5edb8c4ab6185e5)
74 | - Fire error callback when editor cancled [view commit](http://github.com/* remote origin
75 | Fetch URL: https://github.com//commit/138e75652c2cc07504280fae2284442a650573f7)
76 | - Adding installation instructions to README [view commit](http://github.com/* remote origin
77 | Fetch URL: https://github.com//commit/2eec7d249be10ba91da206e17ea37ce054075094)
78 | - Add Quality support [view commit](http://github.com/* remote origin
79 | Fetch URL: https://github.com//commit/d25e741d81323516f0af3e783d61ceaace4ec9f2)
80 | - Add Tool type support (too many to list) [view commit](http://github.com/* remote origin
81 | Fetch URL: https://github.com//commit/d266658ded3fee42029f4f6cef896a6f52ea33be)
82 | - Add Output type support (JPEG,PNG) [view commit](http://github.com/* remote origin
83 | Fetch URL: https://github.com//commit/0113e89ecd61e98b79c1f234e9969fde4add2f2f)
84 | - Image editor depends on client auth [view commit](http://github.com/* remote origin
85 | Fetch URL: https://github.com//commit/a3b01f8b871ca813ef388bb30cee84d76de7dc13)
86 | - Start on ImageEditor [view commit](http://github.com/* remote origin
87 | Fetch URL: https://github.com//commit/faeb2dad3dddde1ad978754464c135ed123a3f71)
88 |
89 | # Change Log
90 |
91 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
21 |
22 | phonegap-plugin-csdk-image-editor
23 | ------------------------
24 |
25 | [](http://waffle.io/CreativeSDK/phonegap-plugin-csdk-image-editor)
26 |
27 | The Creative SDK Image Editor UI component provides a solution for developers seeking to add powerful photo editing to their Android, iOS, and Web apps.
28 |
29 | The Image Editor includes over twenty advanced imaging tools covering everything from Effects and Crop to Redeye and Blemish. The tools are all GPU-accelerated, so all image modifications happen in real time or close to it.
30 |
31 | This plugin makes it possible for you to use the Creative SDK Image Editor in your PhoneGap apps on Android and iOS. Read on to learn how!
32 |
33 | ### Contents
34 |
35 | - [Prerequisites](#prerequisites)
36 | - [Installation](#installation)
37 | - [Setup guide](#setup-guide)
38 | - [Sample code](#sample-code)
39 | - [API guide](#api-guide)
40 |
41 | # Prerequisites
42 |
43 | **Required:** You must first install the [Client Auth plugin](https://github.com/CreativeSDK/phonegap-plugin-csdk-client-auth) for this plugin to work.
44 |
45 | **Required:** This guide will assume that you have installed all software and completed all of the steps in the [Client Auth guide](https://github.com/CreativeSDK/phonegap-plugin-csdk-client-auth).
46 |
47 |
48 | # Installation
49 |
50 | ## Adding the plugin
51 |
52 | Use the command below to add the plugin to your app.
53 |
54 | ### Adding released version
55 |
56 | ```
57 | phonegap plugin add --save phonegap-plugin-csdk-image-editor
58 | ```
59 |
60 | ### Adding development version
61 |
62 | ```
63 | phonegap plugin add --save https://github.com/CreativeSDK/phonegap-plugin-csdk-image-editor
64 | ```
65 |
66 | ## Downloading the Creative SDK
67 |
68 | **iOS**
69 |
70 | To get the iOS SDK, go to the [Downloads page](https://creativesdk.adobe.com/downloads.html), click the download link for `STATIC FRAMEWORKS (DEPRECATED)`, and extract it to the `src/ios` folder of this plugin. Extracting the ZIP will create an `AdobeCreativeSDKFrameworks` folder.
71 |
72 | The ZIP files contain all the frameworks in the Creative SDK, but for this plugin we will only be using the `AdobeCreativeSDKImage.framework`.
73 |
74 |
75 | **Android**
76 |
77 | No action is required for Android. The Creative SDK for Android is delivered as a remote Maven repository, and the required framework will be downloaded automatically by the plugin.
78 |
79 |
80 | # Setup guide
81 |
82 | 1. `cd` into your existing PhoneGap app (must already include [Client Auth](https://github.com/CreativeSDK/phonegap-plugin-csdk-client-auth))
83 | 1. Add this plugin (see "Adding the plugin" above)
84 | 1. **iOS only:** download and add the Creative SDK to this plugin's `src/ios` directory (see "Downloading the Creative SDK" above)
85 | 1. Build and run for your platform
86 |
87 |
88 | # Sample code
89 |
90 | ## `www/index.html`
91 |
92 | Add a button within the `body`. The PhoneGap "Hello World" example includes a `div` with an ID of `app`, so for this example, we are including it in there.
93 |
94 | ```
95 | // ...
96 |
97 |
98 |
99 | // ...
100 |
101 |
102 |
103 |
104 | // ...
105 |
106 | ```
107 |
108 | ## `www/js/index.js`
109 |
110 | _**Note:** Most of the code below comes from the PhoneGap "Hello World" example, and we are providing it here for context._
111 |
112 | This plugin provides access to a global `CSDKImageEditor` object.
113 |
114 | The `CSDKImageEditor` object exposes a `.edit()` function, and some enums to use when setting up your options.
115 |
116 | See comments **#1-2** below for relevant code:
117 |
118 | ```
119 | var app = {
120 | initialize: function() {
121 | this.bindEvents();
122 | },
123 | bindEvents: function() {
124 | // ...
125 |
126 | /* 1) Add a click handler for your button */
127 | document.getElementById('launch-editor').addEventListener('click', this.launchEditor, false);
128 | },
129 | onDeviceReady: function() {
130 | app.receivedEvent('deviceready');
131 | },
132 | receivedEvent: function(id) {
133 | // ...
134 | },
135 |
136 | /* 2) Make a helper function to launch the Image Editor */
137 | launchEditor: function() {
138 |
139 | /* 2.a) Prep work for calling `.edit()` */
140 | function success(newUrl) {
141 | console.log("Success!", newUrl);
142 | }
143 |
144 | function error(error) {
145 | console.log("Error!", error);
146 | }
147 |
148 | var imageUrl = "";
149 |
150 | var options = {
151 | outputType: CSDKImageEditor.OutputType.JPEG,
152 | tools: [
153 | CSDKImageEditor.ToolType.EFFECTS,
154 | CSDKImageEditor.ToolType.CROP
155 | ],
156 | quality: 50
157 | };
158 |
159 | /* 2.b) Launch the Image Editor */
160 | CSDKImageEditor.edit(success, error, imageUrl, options);
161 | }
162 | };
163 | ```
164 |
165 |
166 | # API guide
167 |
168 | [See the full API guide](docs/api.md).
169 |
--------------------------------------------------------------------------------
/docs/api.md:
--------------------------------------------------------------------------------
1 | ## Members
2 |
3 |