Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
/***********************************************************
Thumbnail Maker v 1.2.1
Made by Wonkook Lee (oneook)
Edited by devcomfort (2021.11.22.)
© All Rights Reserved
************************************************************/

/**
* @TODO download_canvas 함수를 실제 페이지에 적용하기
*/

"use strict"

/** UUID 생성 함수
* @returns {UUID}
*/
function uuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}


/** DOWNLOAD API
* @link http://danml.com/download.html
* @param {Element} canvas 엘리먼트를 넣으면, 다운로드 됩니다.
* @return {undefined}
*/

const download_canvas = (canvas_element) => {
const mime_type = "image/jpeg"

canvas_element.toBlob(
(blob) => {
download(blob, `${uuid()}.jpg`, mime_type)
},
mime_type,
0.95
);
};

// HTML2CANVAS API

const produceImageBtn = document.querySelector('#export');
Expand Down Expand Up @@ -272,4 +307,4 @@ init();
const msg = '%cWonkook Lee ⓒ oneook';
const css =
"font-size: 2em; color: #FEDC45; background-color: #000;font-family: 'Noto Sans KR';";
console.log(msg, css);
console.log(msg, css);
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<script defer src="./resource/html2canvas.min.js"></script>
<script defer src="http://danml.com/js/download.js"></script>
<script defer src="app.js"></script>

<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
Expand Down