forked from purplecabbage/phonegap-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow screenshot plugin to optionally return a base64 encoded string …
…to a given function name. Added a README for the screenshot plugin.
- Loading branch information
Showing
3 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This plugin lets you take a screenshot of the viewable screen in iOS without the top status bar. | ||
|
||
You can call this function with | ||
|
||
window.navigator.saveScreenshot( bool returnBase64, [string successCallbackString] ) | ||
|
||
or | ||
|
||
PhoneGap.exec("Screenshot.saveScreenshot", returnBase64, [ successCallbackString ] ); | ||
|
||
Where | ||
|
||
returnBase64 (PNG format for now) is a BOOL to say whether or not we return a base64 encoded string back to Javascript or just let the screenshot get saved to the devices Saved Photos. | ||
|
||
and | ||
|
||
the optional successCallbackString which is the function that will be called with the returned base64 encoded string given as the only parameter. | ||
|
||
So I used this with something like � | ||
|
||
�. | ||
<button onclick="takeScreenshot();">Take Screenshot</button> | ||
|
||
function takeScreenShot() { | ||
PhoneGap.exec("Screenshot.saveScreenshot", true, "returnScreenshotImage"); | ||
} | ||
|
||
function returnScreenshotImage(image) { | ||
base64string = "data:image/png;base64,"+image; | ||
$("#image_container").css("background-image", "url("+base64string+")"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cb4c09a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when i paste the .m code into XCode it errors??? HOw can i get this to work?