Skip to content

Commit

Permalink
📝 package name changed && publish to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigograca31 committed Nov 8, 2019
1 parent fecd0c5 commit b826780
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 68 deletions.
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
Canvas2ImagePlugin
============

### NOTE: I'm gonna try my best to keep this plugin alive moving foward. I've incorporated two important PRs so far, will be accepting more if submitted. (I can read Java and test on Android but I can't code Java...)
# Canvas2ImagePlugin

This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, Android Gallery or WindowsPhone 8 Photo Album from your app.

See an example project using it here: [https://github.com/devgeeks/Canvas2ImageDemo](https://github.com/devgeeks/Canvas2ImageDemo) - note: this app does not work in wp8.

Installation
------------

### For Cordova 3.0.x:
## Installation

1. To add this plugin just type: `cordova plugin add https://github.com/rodrigograca31/Canvas2ImagePlugin`
2. To remove this plugin type: `cordova plugin rm https://github.com/rodrigograca31/Canvas2ImagePlugin`

### NOTE: For older versions of Cordova (You will probably have to use tag 0.2.0)
`cordova plugin add cordova-plugin-canvas2image-updated`

For iOS, you will need to add the following to your config.xml file within `<platform name="ios">`:

Expand All @@ -25,27 +14,26 @@ For iOS, you will need to add the following to your config.xml file within `<pla
</edit-config>
```

Usage:
------
## Usage:

Call the `window.canvas2ImagePlugin.saveImageDataToLibrary()` method using success and error callbacks and the id attribute or the element object of the canvas to save:

### Example

```html
<canvas id="myCanvas" width="165px" height="145px"></canvas>
```

```javascript
function onDeviceReady()
{
function onDeviceReady() {
window.canvas2ImagePlugin.saveImageDataToLibrary(
function(msg){
function(msg) {
console.log(msg);
},
function(err){
function(err) {
console.log(err);
},
document.getElementById('myCanvas'),
document.getElementById("myCanvas"),
"jpeg" // format is optional, defaults to 'png'
);
}
Expand Down
82 changes: 41 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"name": "cordova-plugin-canvas2image",
"version": "1.0.0",
"description": "This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, or Android Gallery from your app.",
"cordova": {
"id": "org.devgeeks.Canvas2ImagePlugin",
"platforms": [
"ios",
"android",
"wp8"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/rodrigograca31/Canvas2ImagePlugin.git"
},
"keywords": [
"canvas",
"image",
"photo library",
"ecosystem:cordova",
"cordova-ios",
"cordova-android",
"cordova-wp8",
"cordova"
],
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
}
],
"author": {
"name": "tommy-carlos williams",
"email": "[email protected]",
"url": "http://devgeeks.org"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/rodrigograca31/Canvas2ImagePlugin/issues"
},
"homepage": "https://github.com/rodrigograca31/Canvas2ImagePlugin#readme"
"name": "cordova-plugin-canvas2image-updated",
"version": "1.1.0",
"description": "This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, or Android Gallery from your app.",
"cordova": {
"id": "cordova-plugin-canvas2image-updated",
"platforms": [
"ios",
"android",
"wp8"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/rodrigograca31/Canvas2ImagePlugin.git"
},
"keywords": [
"canvas",
"image",
"photo library",
"ecosystem:cordova",
"cordova-ios",
"cordova-android",
"cordova-wp8",
"cordova"
],
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
}
],
"author": {
"name": "Rodrigo Graça",
"email": "[email protected]",
"url": "https://rodrigograca.com/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/rodrigograca31/Canvas2ImagePlugin/issues"
},
"homepage": "https://github.com/rodrigograca31/Canvas2ImagePlugin#readme"
}
12 changes: 7 additions & 5 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.devgeeks.Canvas2ImagePlugin"
version="1.0.0">
id="cordova-plugin-canvas2image-updated"
version="1.1.0">

<name>Canvas 2 Image</name>

Expand All @@ -10,7 +10,7 @@
</engines>

<description>This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, or Android Gallery from your app.</description>
<author>Tommy-Carlos Williams - [email protected]</author>
<author>Rodrigo Graça</author>
<keywords>canvas,image,photo library</keywords>

<license>MIT</license>
Expand All @@ -19,6 +19,7 @@
<clobbers target="window.canvas2ImagePlugin" />
</js-module>

<!-- DEPRECATED: maybe can be removed? https://github.com/apache/cordova-plugin-compat -->
<dependency id="cordova-plugin-compat" version="^1.0.0" />

<!-- ios -->
Expand Down Expand Up @@ -51,12 +52,12 @@

<config-file target="res/xml/config.xml" parent="/*">
<feature name="Canvas2ImagePlugin" >
<param name="android-package" value="org.devgeeks.Canvas2ImagePlugin.Canvas2ImagePlugin"/>
<param name="android-package" value="com.rodrigograca.canvas2image.Canvas2ImagePlugin"/>
</feature>
</config-file>

<source-file src="src/android/Canvas2ImagePlugin.java"
target-dir="src/org/devgeeks/Canvas2ImagePlugin" />
target-dir="src/org/rodrigograca/Canvas2ImagePlugin" />

</platform>

Expand All @@ -76,3 +77,4 @@
<source-file src="src/wp8/Canvas2ImagePlugin.cs" />
</platform>
</plugin>

2 changes: 1 addition & 1 deletion src/android/Canvas2ImagePlugin.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.devgeeks.Canvas2ImagePlugin;
package com.rodrigograca.canvas2image;

import java.io.File;
import java.io.FileOutputStream;
Expand Down

0 comments on commit b826780

Please sign in to comment.