i have a code that combines multiple canvasses and saves them into one image file. while this works on non-mobile devices, i tested it on a mobile device and while there is an image produced, opening the file will give you a message that says that "The image _ cannot be displayed because it contains errors."
Here's the code that converts to image:
<script type='text/javascript'>
window.addEventListener('load', function() {
'use strict';
var src = document.getElementById('src');
var dst = document.getElementById('dst');
var dst1 = document.getElementById('dst1');
var input = src.getContext('2d');
var output = dst.getContext('2d');
var output1 = dst1.getContext('2d');
dst.width = dst_w;
dst.height = dst_h;
dst1.width = dst1_w;
dst1.height = dst1_h;
var img=document.getElementById("scream");
input.drawImage(img,0,0);
var sprkl = document.getElementById('sprkl');
var output_s = sprkl.getContext('2d');
input.drawImage(document.getElementById('sparkle'),0,0,150,150);
input.drawImage(document.getElementById('circle'),0,0,<?php echo $lenssize.",".$lenssize.",".$left.",".$top.",".$dia.",".$dia; ?>);
input.drawImage(document.getElementById('circle1'),0,0,<?php echo $lenssize.",".$lenssize.",".$left1.",".$top1.",".$dia1.",".$dia1; ?>);
function gonext() {
var a = document.getElementById('src');
var dataURL = a.toDataURL();
$.post("save.php?filen=<?php echo $filen; ?>", {data: a.toDataURL("image/png")})
window.setTimeout(function() {
document.frmnext.submit();
}, 10000);
}
<div style="position: relative; z-index: 2">
<canvas id="src" width="<?php echo $width; ?>" height="<?php echo $height; ?>"></canvas>
<canvas id="sprkl" style="position: absolute; z-index: 3;"></canvas>
<canvas id="dst" style='position: absolute; z-index: 3'></canvas>
<canvas id="dst1" style='position: absolute; z-index: 3'></canvas>
</div>
To support toDataURL
try this because i think, there is a problem with export image with data string like base64 ...
I had same problem with my project, and i found this solution
$('.jSignature').attr('id','image_b_id');
var canvas_1 = document.getElementById('image_b_id');
var image_b_base64 = canvas_1.toDataURL();
When i create jSignature Canvas
, i could run in many of mobile devices. But there is an error some the other devices such as Galaxy mini ...
I really appreciate your time in replying to my problem, however the solution I've found is here
I simply added the js file and that was it.
Thanks again :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.