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

  • SEARCH
  • Home
  • 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 7585095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:05:25+00:00 2026-05-30T19:05:25+00:00

I have two questions that both work together so I’m putting it in as

  • 0

I have two questions that both work together so I’m putting it in as one.

I’m attempting to duplicate what a user has drawn on one HTML5 canvas to another.

To do this I’m grabbing the dataURL using javascript and assigning a new image to that dataurl and then assigning that image to draw my second canvas’s drawImage. Here is the code.

duplicate=function(){       
    dataURL = oCanvas.toDataURL();
    img.src = dataURL;
    context2.drawImage(img, 0, 0);
        };

The issue with this code is I have to push the duplicate button twice in order for it to show on the second canvas. I believe this is because its trying to do everything in the function at once. When I click duplicate the first time its setting the dataURL and the img src at the same time and img.src is seeing it as an empty string. The second type I click it I’ve already stated that dataURL is what it is and img.src sees it as that…

How do I fix this?

My main goal however is saving this dataURL to a database I’ve attempted to use an ajax with the get method but the problem here is dataURL contains so many characters that cause issue with get.

Is there a special way I can encode the dataURL and make it get/ajax friendly so I can save it to my database?

Thank you very much!

  • 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-30T19:05:26+00:00Added an answer on May 30, 2026 at 7:05 pm

    If the problem is that you are just doing to much or trying to draw the second image too early.

    Call context2.drawImage() on img.onload()

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

Sidebar

Related Questions

I have two questions: (1) I learned somewhere that -O3 is not recommended with
I have two models (questions and answers) that slightly follow the popular Railscasts :
i have two questions, that i encountered in my learning project 1) Setting: i
I have two questions. 1: At the moment I have two model classes that
I actually have two questions regarding exception/error handling in the iPhone app that I
I have two long running queries that are both on transactions and access the
I have two separate files that one is server-side JS. The other one is
I have a website that needs to store two sets of user data into
1) My question is that, when i have two large table which cannot be
I have a question: I have two MSSQL tables, items and states, that are

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.