These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:21 pm Advanced search

toDataURL not work

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

toDataURL not work

Postby diego.delgado » Mon Dec 13, 2010 6:08 pm

Someone can tell me why toDataURL not work? Something wrong?

Code: Select all
var img = new Image();
img.src = '34454.jpg';

var canvasTest = document.getElementById("imgCanvas");
var c = canvas.getContext("2d");
c.drawImage(img, img.width, img.height);
var camURL = canvasTest.toDataURL("image/png");
alert(camURL);



Thank´s!
diego.delgado
<h6>
 
Posts: 1
Joined: Mon Dec 13, 2010 5:46 pm

Postby zcorpan » Tue Dec 14, 2010 8:34 am

Image loading is not sync. You need to wait until the image is loaded before painting it on the canvas.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests