|
|
|
@ -1,4 +1,37 @@
|
|
|
|
|
/* Download an img */
|
|
|
|
|
function imgDownload(cmmFileDtls, appendElementId) {
|
|
|
|
|
const url = '<c:url value="/framework/biz/cmm/file/download.do"/>';
|
|
|
|
|
cmmFileDtls.forEach((dtl, idx) => {
|
|
|
|
|
|
|
|
|
|
fetch(
|
|
|
|
|
url
|
|
|
|
|
, {
|
|
|
|
|
method: 'post'
|
|
|
|
|
, body: JSON.stringify(dtl)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.then((response) => response.blob())
|
|
|
|
|
.then((blob) => {
|
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
|
|
|
|
|
|
var x = document.createElement("img");
|
|
|
|
|
x.setAttribute("src", url);
|
|
|
|
|
//x.style = 'width:150px; display: block;';
|
|
|
|
|
x.style = 'height:150px;';
|
|
|
|
|
//x.setAttribute("width", "304");
|
|
|
|
|
//x.setAttribute("height", "228");
|
|
|
|
|
x.setAttribute("title", dtl.orginlFileNm);
|
|
|
|
|
x.setAttribute("alt", dtl.orginlFileNm);
|
|
|
|
|
document.querySelector(appendElementId).appendChild(x);
|
|
|
|
|
|
|
|
|
|
// Revoke Blob URL after DOM updates..
|
|
|
|
|
//window.URL.revokeObjectURL(objectURL);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function download(img) {
|
|
|
|
|
var link = document.createElement("a");
|
|
|
|
|
link.href = img.src;
|
|
|
|
@ -23,7 +56,7 @@ function downloadAll(imgs, ext, limit) {
|
|
|
|
|
/* If specified, filter images by extension */
|
|
|
|
|
if (ext) {
|
|
|
|
|
ext = "." + ext;
|
|
|
|
|
imgs = [].slice.call(imgs).filter(function(img) {
|
|
|
|
|
imgs = [].slice.call(imgs).filter(function (img) {
|
|
|
|
|
var src = img.src;
|
|
|
|
|
return (src && (src.indexOf(ext, src.length - ext.length) !== -1));
|
|
|
|
|
});
|
|
|
|
@ -61,9 +94,8 @@ function addDownloadBtn() {
|
|
|
|
|
btn.style.top = btn.style.left = "0px";
|
|
|
|
|
document.body.appendChild(btn);
|
|
|
|
|
}
|
|
|
|
|
addDownloadBtn();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addDownloadBtn();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
images = document.querySelectorAll("img");
|
|
|
|
@ -89,9 +121,7 @@ for (i of images) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let i=1; i<35; i++){
|
|
|
|
|
for (let i = 1; i < 35; i++) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
fetch(`https://testing-images/images-${i}.jpg`)
|
|
|
|
|
.then(resp => resp.blob())
|
|
|
|
@ -107,11 +137,10 @@ for(let i=1; i<35; i++){
|
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
})
|
|
|
|
|
.catch(() => alert('oh no!'));
|
|
|
|
|
}, i*1000);
|
|
|
|
|
}, i * 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urls.forEach(function (e) {
|
|
|
|
|
fetch(e.download)
|
|
|
|
|
.then(res => res.blob())
|
|
|
|
@ -121,15 +150,9 @@ urls.forEach(function (e) {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="tui-image-editor-container"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link
|
|
|
|
|
rel="stylesheet"
|
|
|
|
|
href="/resources/3rd-party/tui/image-editor-3.15.3/tui-image-editor.css"
|
|
|
|
@ -137,34 +160,34 @@ urls.forEach(function (e) {
|
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.0/fabric.js"></script>
|
|
|
|
|
<script type="text/javascript" src="https://uicdn.toast.com/tui.code-snippet/v1.5.0/tui-code-snippet.min.js"></script>
|
|
|
|
|
<script type="text/javascript" src="https://uicdn.toast.com/tui-color-picker/v2.2.6/tui-color-picker.js"></script>
|
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
|
|
|
|
|
<script type="text/javascript"
|
|
|
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
|
|
|
|
|
<script type="text/javascript" src="/resources/3rd-party/tui/image-editor-3.15.3/tui-image-editor.js"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
|
const options = {
|
|
|
|
|
includeUI: {
|
|
|
|
|
loadImage: {
|
|
|
|
|
path: 'img/sampleImage2.png',
|
|
|
|
|
name: 'SampleImage'
|
|
|
|
|
},
|
|
|
|
|
//theme: 'blackTheme', // or whiteTheme
|
|
|
|
|
initMenu: 'filter',
|
|
|
|
|
menuBarPosition: 'right'
|
|
|
|
|
},
|
|
|
|
|
loadImage: {
|
|
|
|
|
path: 'img/sampleImage2.png',
|
|
|
|
|
name: 'SampleImage'
|
|
|
|
|
},
|
|
|
|
|
//theme: 'blackTheme', // or whiteTheme
|
|
|
|
|
initMenu: 'filter',
|
|
|
|
|
menuBarPosition: 'right'
|
|
|
|
|
},
|
|
|
|
|
cssMaxWidth: 700,
|
|
|
|
|
cssMaxHeight: 500,
|
|
|
|
|
usageStatistics: true,
|
|
|
|
|
selectionStyle: {
|
|
|
|
|
cornerSize: 20,
|
|
|
|
|
rotatingPointOffset: 70,
|
|
|
|
|
}
|
|
|
|
|
cornerSize: 20,
|
|
|
|
|
rotatingPointOffset: 70,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const imageEditor = new tui.ImageEditor(document.querySelector('#tui-image-editor-container'), options);
|
|
|
|
|
tui.usageStatistics = false;
|
|
|
|
|
// window.onresize = function() {
|
|
|
|
|
const imageEditor = new tui.ImageEditor(document.querySelector('#tui-image-editor-container'), options
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
tui.usageStatistics = false;
|
|
|
|
|
// window.onresize = function () {
|
|
|
|
|
// imageEditor.ui.resizeEditor();
|
|
|
|
|
// }
|
|
|
|
|