1
캔버스에 사용자가 업로드 한 이미지를 그린 다음 이미지의 크기를 조정하여 아마존 S3에 보냅니다. 그러나 그려지는 동안 사용자에게 이미지를 보여주고 싶지는 않습니다. 숨겨진 상태로 유지하고 싶습니다. 이것이 가능한가? 나는 이것을 처리하기 위해 각도 j와 각도 업로드를 사용하고 있습니다. 두 번째 대안은 다소 멋있게 보이는 테이블에 이미지를 그리는 것이지만, 먼저이 이미지를 크랙 할 수 있는지 확인하고 싶습니다. 여기 코드는 다음과 같습니다html5 캔버스에 숨겨진 이미지 그리기
$scope.onFileSelect = function ($files) {
$scope.files = $files;
$scope.upload = [];
for (var i = 0; i < $files.length; i++) {
var fr = new FileReader();
fr.onload = function (e) {
var img = new Image();
var fileSent = false;
img.onload = function(){
var MAXWidthHeight = 488;
var ratio = MAXWidthHeight/Math.max(this.width,this.height);
var w = Math.round(this.width * ratio);
var h = Math.round(this.height * ratio);
var c = document.createElement("canvas");
c.width = w;
c.height = h;
c.setAttribute("hidden", true);
c.getContext("2d").drawImage(this,0,0,w,h);
this.src = c.toDataURL();
if(!fileSent) {
sendToS3(c.toDataURL());
fileSent = true;
}
document.body.appendChild(this);
}
img.src = e.target.result;
}
fr.readAsDataURL($files[i]);
}
};
S3에 이미지를 보내기 전에 이미지가 완전히로드됩니다. SendToS3과 청취자를 변경할 것입니다. – GameAlchemist