2023-08-01 19:16:46 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<link rel="stylesheet" href="croppie.css" />
|
|
|
|
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
|
2023-08-07 21:27:38 -04:00
|
|
|
<script src="http://localhost:35729/livereload.js"></script>
|
2023-08-01 19:16:46 -04:00
|
|
|
<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())
|
2023-08-03 19:33:05 -04:00
|
|
|
console.log(cpie.element.clientWidth)
|
|
|
|
console.log(cpie.element.clientHeight)
|
2023-08-01 19:16:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
2023-08-03 19:33:05 -04:00
|
|
|
<!--
|
2023-08-07 21:27:38 -04:00
|
|
|
width: 3264px;
|
|
|
|
height: 4224px;
|
|
|
|
width: 8.5in;
|
|
|
|
height: 11in;
|
2023-08-03 19:33:05 -04:00
|
|
|
-->
|
2023-08-01 19:16:46 -04:00
|
|
|
<style>
|
2023-08-07 21:27:38 -04:00
|
|
|
.image-surface {
|
2023-08-01 19:16:46 -04:00
|
|
|
overflow: hidden;
|
|
|
|
margin: auto;
|
2023-08-07 21:27:38 -04:00
|
|
|
background-color: lightgreen;
|
|
|
|
}
|
|
|
|
.imagebox {
|
|
|
|
grid-area: image;
|
|
|
|
display:flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
padding: 50px;
|
|
|
|
flex: 70%;
|
|
|
|
}
|
|
|
|
.container {
|
|
|
|
display: flex;
|
|
|
|
background-color: lightyellow;
|
|
|
|
height: calc(100vh - 20px);
|
|
|
|
}
|
|
|
|
.controls {
|
|
|
|
background-color: lightgrey;
|
|
|
|
display: flex;
|
|
|
|
grid-area: controls;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex: 30%;
|
|
|
|
}
|
|
|
|
.showbuton {
|
|
|
|
font-size: 2rem;
|
2023-08-01 19:16:46 -04:00
|
|
|
}
|
2023-08-07 21:27:38 -04:00
|
|
|
.letter-portrait {
|
|
|
|
height: 100%;
|
|
|
|
aspect-ratio: 85 / 110;
|
|
|
|
}
|
|
|
|
.letter-portrait .img {
|
2023-08-01 19:16:46 -04:00
|
|
|
height: 50%;
|
|
|
|
}
|
2023-08-07 21:27:38 -04:00
|
|
|
.letter-landscape-2 {
|
|
|
|
display:flex;
|
|
|
|
// width: 80vh;
|
|
|
|
height: 100%;
|
|
|
|
// margin: auto;
|
|
|
|
// aspect-ratio: 110 / 85;
|
|
|
|
aspect-ratio: 7 / 5;
|
|
|
|
}
|
|
|
|
.letter-landscape-2 .img1 {
|
|
|
|
flex: 60%;
|
|
|
|
}
|
|
|
|
.letter-landscape-2 .img2 {
|
|
|
|
flex: 40%;
|
|
|
|
}
|
2023-08-01 19:16:46 -04:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body onload="main()">
|
|
|
|
<div class="container">
|
2023-08-07 21:27:38 -04:00
|
|
|
<div class="controls">
|
|
|
|
<button class="showbuton" onClick="showCrop()">Snap Collage</button>
|
|
|
|
</div>
|
|
|
|
<div class="imagebox">
|
|
|
|
<div class="image-surface letter-landscape-2">
|
|
|
|
<div class="img img1" id="idimg1">
|
|
|
|
<!-- <img src="img1.jpg"> -->
|
|
|
|
</div>
|
|
|
|
<div class="img img2" id="idimg2">
|
|
|
|
<!-- <img src="img2.jpg"> -->
|
|
|
|
</div>
|
2023-08-01 19:16:46 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|