Canvas2ImagePlugin
Canvas2ImagePlugin copied to clipboard
(iOS) How to get the ImageURI of the saved image?
Has some method to return the ImageURI?? I need this information to pass to FileTransfer
Hi i have same question. For Android it return in success calback, but for iPhone success calback return just "Image saved"
Here discribed how to do it http://stackoverflow.com/questions/4457904/iphone-how-do-i-get-the-file-path-of-an-image-saved-with-uiimagewritetosavedpho
Any progress with this issue?
I've made a fork implementing what's described in the above stackoverflow. https://github.com/nicolasgrolleau/Canvas2ImagePlugin.git I also made a pull request but I think the project's owner doesn't have much time for this project.
I am hoping to devote some time to this project soon. I'll look at your fork and pull requests as soon as I can. I really appreciate your work on this @nicolasgrolleau
@nicolasgrolleau how can we get the imageURI in your fork's version ?
Same as for the android version, it's passed to the success callback.
@nicolasgrolleau Great! Does it work in WP8?
I havent't patched the WP8 plufin in my fork (not using WP8 for the moment). The WP8 plugin returns "Image saved: " + picture.Name So you can use it like this and use javascript to remove "Image saved: " from the returned string. It sure would be better to have same behaviour for all platforms.
Yeah, I really needed the full path to the picture. Thanks for the quick replies!
The pull request can be found in issue #45.
For those needing to access the file created:
The path returned by the code is a native uri like
assets-library://asset/asset.PNG?id=C68D47DF-711F-490C-87FD-BEF6172A71CE&ext=PNG
. This native uri cannot be used in for example image tags since it is an unsupported url. To convert it to a file path, use this snippet:
canvas2ImagePlugin.saveImageDataToLibrary(
function (nativeUri) {
resolveLocalFileSystemURL(nativeUri, function (fileEntry) {
fileEntry.file(function (file) {
var result = file.localURL;
...
};
});
} ...
I am taking the saved file and uploading it my server and then I want to remove it from the phone. The upload works great using the code above so I know I am getting the right path. But The file remove fails. Is this because you are not permitted to remove files from the gallery programatically?
Hi @nicolasgrolleau Thanks so much for continuing the work on this plugin! I was having the problem on iOS where the callback simply returned "image saved" and thought I would try your fork.
However, now anytime I try to call the saveImageDataToLibrary function, the app crashes completely.
Is there anything in particular that I need to do for this to work, other than simply installing the plugin?
Thanks again!
EDIT:
I discovered that I needed to merge with this commit: https://github.com/devgeeks/Canvas2ImagePlugin/commit/7cd3f03b8ccbac361b8def565877e934413aa110
After that it worked great. Thanks again!
If i don't use the plugin Canvas2ImagePlugin, i can save canvas image to sd card with html5 and jquery mobile ? please tell me . thanks all