devgeeks / Canvas2ImagePlugin

PhoneGap / Cordova plugin for iOS to save the contents of an HTML canvas to the device's Photo Library
211 stars 218 forks source link

Canvas2ImagePlugin "Hello World" with PhoneGap Build #39

Open slincke opened 10 years ago

slincke commented 10 years ago

I'm still having trouble getting the plugin to work on my iOS device through PhoneGap Build. I'm using the Config.xml that you pointed me to -https://gist.github.com/devgeeks/ba5a96e3d673b84c9e75 - only modified to use my app icon assets and I'm using the following minimalist index.html in order to diagnose the issue. Can anyone see what I'm doing wrong here. I've been using Build quite successfully on my main app, but am struggling to get this plugin to work even in this simplest case. I'm losing my mind on this! Is my canvas not valid in some way? Really appreciate any help.

<!DOCTYPE html> 
<html> 
    <head> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css" />
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">

var container;
var c;

document.addEventListener("deviceready",onDeviceReady,false);

function onDeviceReady() {
   window.canvas2ImagePlugin.saveImageDataToLibrary(
        function(msg){
            console.log(msg);
        },
        function(err){
            console.log(err);
        },
        document.getElementById("myCanvas")
    );
}

</script>

<style type="text/css">
    #myCanvas {
        border: dotted 3px black;
        background-color: lightGray;
    }
</style>

</head> 
<body> 
    <div data-role="page" id="main" >
        <div data-role="header" data-position="fixed" style="min-height: 45px; padding-top: 15px;"">
            <h1><div id="posttitlearea" style="display:inline; top: 20px;">Hello World for canvas2ImagePlugin</div></h1>
        </div><!-- /header -->
        <div data-role="content" >          
            <p>This document contains our first canvas example</p>
            <canvas id="myCanvas" width="250" height="300"></canvas>
        </div><!-- /content -->
        <div data-role="footer" data-position="fixed">
        </div><!-- /footer -->
    </div><!-- /page postdetail -->
</body>
</html>
devgeeks commented 10 years ago

For some reason, github was not notifying me of new issues in this repo, so I have missed a bunch of them.

:(

I'll look into this and see if I can figure out what it going on.

arulapj commented 9 years ago

is it resolved.. i am unable to do same.. its not saving the canvas data