66 lines
1.7 KiB
HTML
66 lines
1.7 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<link rel="stylesheet" href="croppie.css" />
|
||
|
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
|
||
|
<script src="croppie.js"></script>
|
||
|
<script>
|
||
|
|
||
|
var crops = [];
|
||
|
|
||
|
function makeCroppie(divId, imgUrl) {
|
||
|
elem = document.getElementById(divId)
|
||
|
cpie = new Croppie(elem, {
|
||
|
viewport: {
|
||
|
width: elem.clientWidth,
|
||
|
height: elem.clientHeight,
|
||
|
type: 'square'
|
||
|
},
|
||
|
showZoomer: false,
|
||
|
});
|
||
|
|
||
|
cpie.bind({
|
||
|
url: imgUrl
|
||
|
});
|
||
|
|
||
|
crops.push(cpie)
|
||
|
}
|
||
|
|
||
|
function main() {
|
||
|
makeCroppie('idimg1', 'img1.jpg')
|
||
|
makeCroppie('idimg2', 'img2.jpg')
|
||
|
}
|
||
|
|
||
|
function showCrop() {
|
||
|
for(cpie of crops) {
|
||
|
console.log(cpie.get())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
<style>
|
||
|
.container {
|
||
|
height: 11in;
|
||
|
width: 8.5in;
|
||
|
overflow: hidden;
|
||
|
margin: auto;
|
||
|
border: 1px solid;
|
||
|
}
|
||
|
.img1, .img2 {
|
||
|
height: 50%;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body onload="main()">
|
||
|
<div class="container">
|
||
|
<div class="img1" id="idimg1">
|
||
|
<!-- <img src="img1.jpg"> -->
|
||
|
</div>
|
||
|
<div class="img2" id="idimg2">
|
||
|
<!-- <img src="img2.jpg"> -->
|
||
|
</div>
|
||
|
</div>
|
||
|
<button onClick="showCrop()">Show</button>
|
||
|
</body>
|
||
|
</html>
|