Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7503627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:17:50+00:00 2026-05-29T21:17:50+00:00

In android phonegap application I crated canvas using html and display image in that

  • 0

In android phonegap application I crated canvas using html and display image in that canvas.then usingcanvas.toDataURL(image/jpg) tried to convert image into base64 string but it return null value.
How to solve this problem?
hoe to convert image into base64string?

Mycoding:

<html>
<body>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>
 <img style="display:none;width:60px;height:60px;" id="smallImage" src="" />
<script type="text/javascript">
   // window.onload = fucntion() {  

        var c=document.getElementById('myCanvas');
        var cxt=c.getContext("2d");
        var img=new Image();
        img.onload = function() { 
            cxt.drawImage(img,0,0);
           alert(" ");
            var dataURL=myCanvas.toDataURL("image/jpg");
            // return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
            alert(dataURL);
        };
        img.src='flower.jpg';

    //};
</script>

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:17:52+00:00Added an answer on May 29, 2026 at 9:17 pm

    toDataURL is not implememented in android 2.x, see http://code.google.com/p/android/issues/detail?id=7901 for discussion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application built using PhoneGap (Android) that is essentially a shell for
I'm building an Android application that's based around an enhanced WebView (based on PhoneGap).
I'm writing an application in PhoneGap that I want to run on iOS, Android,
I am developing application using phonegap in eclipse for android .I have created folder
I am making the phonegap android application in html,javascript and jquery.I have made the
How do I fully close a PhoneGap Android app? I've tried using device.exitApp() as
I have an application that is using jquery, jquerymobile and spine.js running on phonegap
I am writing application using PhoneGap on Android. I need to call some PhoneGap
I am developing an application for Android using phonegap. When I include phonegap.js file
I am developing an Application using Phonegap on Android. Everything works fine on OS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.