javascript - Image included in canvas does not appear on generated image -



javascript - Image included in canvas does not appear on generated image -

i'm using canvas allow users "design" add together later transformed image displayed on website. in design, users can add together logo. i'm using function add together logo canvas:

function canvaslogo(){ var x = 70; var y = 70; // var width = 500; // var height = 500; var imageobj = new image(); imageobj.onload = function() { var imagewidth = imageobj.width; var imageheight = imageobj.height; if (imageheight > imagewidth) { imagewidth = (imagewidth / imageheight) * 490; imageheight = 490; } else { imageheight = (imageheight / imagewidth) * 490; imagewidth = 490; } x = x + (500 - imagewidth) / 2; y = y + (500 - imageheight) / 2; roundedimage(70, 70, 500, 500, 30, 0, 0, 30); global.kanvas.ctx.clip(); global.kanvas.ctx.fillstyle = "white"; global.kanvas.ctx.fillrect(70, 70, 500, 500); global.kanvas.ctx.drawimage(imageobj, x, y, imagewidth, imageheight); console.log("logo cargado"); }; imageobj.src = global.kanvas.logo;

}

and users add together other things text , colors , when click button create add together use:

function crearanuncio(elm){ if($("#advanced-wizard").valid() && global.form.idmetodopago > 0){ nprogress.start(); global.kanvas.size = "z"; settimeout(function(){ render(); global.kanvas.ctx.scale(1*3,1*3); settimeout(function(){ kanv = document.getelementbyid(global.kanvas.canvasid); var imgb = kanv.todataurl("image/png"); var serialform = $("#advanced-wizard").serialize(); var arguments = serialform+"&file="+encodeuricomponent(imgb); deliver(arguments); console.log(global.request.response); // run paypal if(global.form.idmetodopago==1){ document.getelementbyid('paypal_process').submit(); } else { global.request.response = ''; deliver_site(arguments, "success.php"); window.location.href="success.php?token="+global.request.response; } nprogress.done(); }, 550); },150); } else { alert('seleccione el método de pago '); }

}

to transform canvas png displayed on site.

the thing (haven't been able replicate error myself , clients happens "sometimes") logo not rendered in final image (text , colors do). space logo blank. clients tell me see logo on canvas before pressing generate button.

it doesn't appear related operative scheme or browser since same computer creates add together alright , without logo. thought server changed , upgraded hosting , still happened.

any thought on going wrong?

javascript canvas html5-canvas

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -