I am using html2canvas.js to create a <canvas>
image from a div on a page. What I'd like to do is send the rendered base64 image to a cfc via ajax so I can actually save the image to a folder on the server and return the file path to the page.
The issue I am running into is that when I send the base64 encoded data to the cfc, the cfc interprets the data, but with several instances of "[invalid]" within the data.
If I just post the image to the DOM, the image renders just fine. Here is a link to a gist that has both the normal image created compared to the one that I dump from the argument passed into the cfc: https://gist.github.com/ronnieduke/d83dfb3e31677191f88e
Here is the Ajax I am running (where img.src is the result of the canvas data posted in the link above)
var image = new Image();
image.id = 'pic';
// This results in the base64 data posted in image-normal.txt in the gist
image.src = canvas.toDataURL("image/png");
var data = new FormData();
data.append('imgData',image.src);
// Genrate images in cfc
$.ajax({
url: 'my.cfc?method=generateImage',
type:'POST',
data:data,
dataType:'JSON',
processData: false,
cache:false,
async:false,
contentType: false,
success:function(data){
console.log(data);
},
error:function(result){
alert(result.responseText);
}
});
I have the following setup where a custom checkmark is added to style the radio buttons. but it also adds that checkmark to the text type inputs. var changed =function(){ Array.from(...
I have the following setup where a custom checkmark is added to style the radio buttons. but it also adds that checkmark to the text type inputs. var changed =function(){ Array.from(...
I need to take some non-trivial javascript and ensure that all code paths have code that is valid. For example: var num = 1; if (num == 2) { badFunctionName(); } and I need to do this from C#. ...
I need to take some non-trivial javascript and ensure that all code paths have code that is valid. For example: var num = 1; if (num == 2) { badFunctionName(); } and I need to do this from C#. ...
Suppose you have an array that is modified by one asynchronous process and then you have another asynchronous process that reads from the same array. Modifications and reads are done synchronously. ...
Suppose you have an array that is modified by one asynchronous process and then you have another asynchronous process that reads from the same array. Modifications and reads are done synchronously. ...
I'm using divs to make an OnePage Site but I found some problems when the "refresh page" is needed. I can't use the ID a href in this case, but I need to use transitions to change the pages. Can I ...
I'm using divs to make an OnePage Site but I found some problems when the "refresh page" is needed. I can't use the ID a href in this case, but I need to use transitions to change the pages. Can I ...