photo page button stuff, js
This commit is contained in:
parent
2ead3f5aaa
commit
79ffd9d369
21
web/main.js
21
web/main.js
@ -31,6 +31,7 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||||||
window.setInterval( update, 7000 );
|
window.setInterval( update, 7000 );
|
||||||
|
|
||||||
initState();
|
initState();
|
||||||
|
initPhotoStuff();
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -322,7 +323,7 @@ var progressEl = document.getElementById('progress');
|
|||||||
var totalEl = document.getElementById('total');
|
var totalEl = document.getElementById('total');
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
function initPhotoStuff(){
|
||||||
canvas1 = document.getElementById('canvas1');
|
canvas1 = document.getElementById('canvas1');
|
||||||
context1 = canvas1.getContext('2d');
|
context1 = canvas1.getContext('2d');
|
||||||
canvas2 = document.getElementById('canvas2');
|
canvas2 = document.getElementById('canvas2');
|
||||||
@ -335,25 +336,25 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||||||
|
|
||||||
fileInput.onchange = onFileInputChange;
|
fileInput.onchange = onFileInputChange;
|
||||||
|
|
||||||
document.getElementById('rotLeft').onclick = onRotateLeft;
|
document.getElementById('rot-left').onclick = onRotateLeft;
|
||||||
document.getElementById('rotRight').onclick = onRotateRight;
|
document.getElementById('rot-right').onclick = onRotateRight;
|
||||||
},false);
|
document.getElementById('submit-photo').onclick = submitImage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function submitImage(){
|
function submitImage(){
|
||||||
|
|
||||||
// convert canvas to html/base64 image
|
// convert canvas to html/base64 image
|
||||||
var image = new Image(); //create new image holder
|
var image = new Image(); //create new image holder
|
||||||
image.id = "outputImage" //id it
|
image.id = "outputImage"; //id it
|
||||||
|
|
||||||
var canvas = document.getElementById('canvas3'); // choose canvas element to convert
|
var canvas = document.getElementById('canvas3'); // choose canvas element to convert
|
||||||
var dataURL = canvas.toDataURL(); // convert cabvas to data url we can handle
|
var dataURL = canvas.toDataURL(); // convert cabvas to data url we can handle
|
||||||
|
|
||||||
//console.log(dataURL);
|
|
||||||
|
|
||||||
var outputImg = document.createElement("img"); // create img tag
|
var outputImg = document.createElement("img"); // create img tag
|
||||||
outputImg.src = dataURL // assign dataurl to image tag 'src' option
|
outputImg.src = dataURL; // assign dataurl to image tag 'src' option
|
||||||
document.body.appendChild(outputImg); // append img to body (to be assigned to place holder div)
|
//document.body.appendChild(outputImg); // append img to body (to be assigned to place holder div)
|
||||||
|
|
||||||
// append data to text area...not working yet..
|
// append data to text area...not working yet..
|
||||||
var photo = document.getElementById('message'); // add data url to message field... not working yet
|
var photo = document.getElementById('message'); // add data url to message field... not working yet
|
||||||
@ -361,7 +362,7 @@ function submitImage(){
|
|||||||
//photo += outputImg.src;
|
//photo += outputImg.src;
|
||||||
photo.innerHTML += outputImg.src;
|
photo.innerHTML += outputImg.src;
|
||||||
|
|
||||||
// sendMessage( "10 ", "outputImg.src" ); << breaks vereything ;) and is an bad idea: TODO: append data stringto message field, or url whatever and preview it locally (append to body) before submitting, but textarea is refreshing or something ugh...aka find clean solution, add url parameter instead of dirty innerhtml hacking
|
sendMessage( new Date().getTime(), "test"); //<< breaks vereything ;) and is an bad idea: TODO: append data stringto message field, or url whatever and preview it locally (append to body) before submitting, but textarea is refreshing or something ugh...aka find clean solution, add url parameter instead of dirty innerhtml hacking
|
||||||
//TEST INNNETHTML ADD TO TEXATAREA QUICKYYYYY
|
//TEST INNNETHTML ADD TO TEXATAREA QUICKYYYYY
|
||||||
|
|
||||||
console.log(photo.innerHTML);
|
console.log(photo.innerHTML);
|
||||||
|
Loading…
Reference in New Issue
Block a user