티스토리 뷰
Canvas 에서 이미지 생성 후 이미지 회전
rotateBase64Image(canvas.toDataURL());
toDataURL 자료를 Oracle Blob Column 에 저장
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, Object> tmpMap = new HashMap<>(); | |
byte[] bytes = DatatypeConverter.parseBase64Binary(imgStr.substring(imgStr.indexOf(",") + 1)); | |
tmpMap.put("IMG", bytes); | |
// Oracle Blob Column IMG Insert | |
// INTO IMAGE_TBL VALUES (#{SEQ}, #{IMG}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rotateBase64Image(base64ImageSrc) { | |
var canvas = document.getElementById("canvasHidden"); | |
var img = new Image(); | |
img.src = base64ImageSrc; | |
canvas.width = img.width; | |
canvas.height = img.height; | |
var context = canvas.getContext("2d"); | |
context.translate(img.width * 0.5, img.height * 0.5); | |
context.rotate(0.5 * Math.PI); | |
context.translate(-img.height * 0.5, -img.width * 0.5); | |
context.drawImage(img, 0, 0); | |
return canvas.toDataURL(); | |
} |
'IT > JavaScript' 카테고리의 다른 글
javascript 정규식에서 global flag 사용하면 정규식 객체가 lastIndex를 유지 (0) | 2014.11.26 |
---|---|
ECMAScript 6: what’s next for JavaScript? (August 2014) (0) | 2014.09.02 |
JavaScript todomvc (0) | 2014.07.21 |
e-mail check 정규식 (0) | 2014.07.21 |
배열 중복 체크 (0) | 2014.07.21 |