aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/examples
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-03-09 11:12:18 +0100
committerMario <mario@mariovavti.com>2018-03-09 11:12:18 +0100
commit4baf5eab16d809977a44e7911ddcab0ff8383897 (patch)
tree393f618c4cfc20f53264ecd8a26a08de0823d35d /library/cropperjs/examples
parent577da0eb9eb1f90a4cf7a70cfb3582cfb49007ac (diff)
parent7361af85b5488fc8bd1744389a3a332dc74276b0 (diff)
downloadvolse-hubzilla-3.2.tar.gz
volse-hubzilla-3.2.tar.bz2
volse-hubzilla-3.2.zip
Merge branch '3.2RC'3.2
Diffstat (limited to 'library/cropperjs/examples')
-rw-r--r--library/cropperjs/examples/a-range-of-aspect-ratio.html71
-rw-r--r--library/cropperjs/examples/crop-a-round-image.html103
-rw-r--r--library/cropperjs/examples/crop-cross-origin-image.html49
-rw-r--r--library/cropperjs/examples/crop-on-canvas.html64
-rw-r--r--library/cropperjs/examples/cropper-in-modal.html76
-rw-r--r--library/cropperjs/examples/customize-preview.html123
-rw-r--r--library/cropperjs/examples/fixed-crop-box.html48
-rw-r--r--library/cropperjs/examples/full-crop-box.html48
-rw-r--r--library/cropperjs/examples/mask-an-image.html123
-rw-r--r--library/cropperjs/examples/multiple-croppers.html48
-rw-r--r--library/cropperjs/examples/responsive-container.html49
11 files changed, 802 insertions, 0 deletions
diff --git a/library/cropperjs/examples/a-range-of-aspect-ratio.html b/library/cropperjs/examples/a-range-of-aspect-ratio.html
new file mode 100644
index 000000000..fae5cb60b
--- /dev/null
+++ b/library/cropperjs/examples/a-range-of-aspect-ratio.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with a range of aspect ratio</h1>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var minAspectRatio = 0.5;
+ var maxAspectRatio = 1.5;
+ var cropper = new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var containerData = cropper.getContainerData();
+ var cropBoxData = cropper.getCropBoxData();
+ var aspectRatio = cropBoxData.width / cropBoxData.height;
+ var newCropBoxWidth;
+
+ if (aspectRatio < minAspectRatio || aspectRatio > maxAspectRatio) {
+ newCropBoxWidth = cropBoxData.height * ((minAspectRatio + maxAspectRatio) / 2);
+
+ cropper.setCropBoxData({
+ left: (containerData.width - newCropBoxWidth) / 2,
+ width: newCropBoxWidth
+ });
+ }
+ },
+ cropmove: function () {
+ var cropper = this.cropper;
+ var cropBoxData = cropper.getCropBoxData();
+ var aspectRatio = cropBoxData.width / cropBoxData.height;
+
+ if (aspectRatio < minAspectRatio) {
+ cropper.setCropBoxData({
+ width: cropBoxData.height * minAspectRatio
+ });
+ } else if (aspectRatio > maxAspectRatio) {
+ cropper.setCropBoxData({
+ width: cropBoxData.height * maxAspectRatio
+ });
+ }
+ }
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/crop-a-round-image.html b/library/cropperjs/examples/crop-a-round-image.html
new file mode 100644
index 000000000..da027d847
--- /dev/null
+++ b/library/cropperjs/examples/crop-a-round-image.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ .cropper-view-box,
+ .cropper-face {
+ border-radius: 50%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Crop a round image</h1>
+ <h3>Image</h3>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Result</h3>
+ <p>
+ <button type="button" id="button">Crop</button>
+ </p>
+ <div id="result"></div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ (function () {
+
+ function getRoundedCanvas(sourceCanvas) {
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+ var width = sourceCanvas.width;
+ var height = sourceCanvas.height;
+
+ canvas.width = width;
+ canvas.height = height;
+
+ context.imageSmoothingEnabled = true;
+ context.drawImage(sourceCanvas, 0, 0, width, height);
+ context.globalCompositeOperation = 'destination-in';
+ context.beginPath();
+ context.arc(width / 2, height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI, true);
+ context.fill();
+
+ return canvas;
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.getElementById('image');
+ var button = document.getElementById('button');
+ var result = document.getElementById('result');
+ var croppable = false;
+ var cropper = new Cropper(image, {
+ aspectRatio: 1,
+ viewMode: 1,
+ ready: function () {
+ croppable = true;
+ }
+ });
+
+ button.onclick = function () {
+ var croppedCanvas;
+ var roundedCanvas;
+ var roundedImage;
+
+ if (!croppable) {
+ return;
+ }
+
+ // Crop
+ croppedCanvas = cropper.getCroppedCanvas();
+
+ // Round
+ roundedCanvas = getRoundedCanvas(croppedCanvas);
+
+ // Show
+ roundedImage = document.createElement('img');
+ roundedImage.src = roundedCanvas.toDataURL()
+ result.innerHTML = '';
+ result.appendChild(roundedImage);
+ };
+
+ });
+
+ })();
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/crop-cross-origin-image.html b/library/cropperjs/examples/crop-cross-origin-image.html
new file mode 100644
index 000000000..54f08664a
--- /dev/null
+++ b/library/cropperjs/examples/crop-cross-origin-image.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Crop a cross origin image</h1>
+ <p>A cross origin image with a <code>crossorigin</code> attribute and an available <code>Access-Control-Allow-Origin</code> response header can be cropped by Cropper.</p>
+ <h3>Image</h3>
+ <div>
+ <img id="image" src="https://raw.githubusercontent.com/fengyuanchen/cropperjs/master/docs/images/picture.jpg" crossorigin>
+ </div>
+ <h3>Result</h3>
+ <div id="result"></div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var result = document.querySelector('#result');
+ var cropper = new Cropper(image, {
+ ready: function () {
+ var image = new Image();
+
+ image.src = cropper.getCroppedCanvas().toDataURL('image/jpeg');
+ result.appendChild(image);
+ },
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/crop-on-canvas.html b/library/cropperjs/examples/crop-on-canvas.html
new file mode 100644
index 000000000..228e36f75
--- /dev/null
+++ b/library/cropperjs/examples/crop-on-canvas.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Crop on canvas with Cropper</h1>
+ <h3>Image</h3>
+ <div class="img-container">
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Canvas</h3>
+ <div class="img-container">
+ <canvas id="canvas"></canvas>
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ function start() {
+ var width = this.offsetWidth;
+ var height = this.offsetHeight;
+ var cropper;
+
+ canvas.width = width;
+ canvas.height = height;
+ canvas.getContext('2d').drawImage(
+ this,
+ 0, 0, this.naturalWidth, this.naturalHeight,
+ 0, 0, width, height
+ );
+
+ cropper = new Cropper(canvas);
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var canvas = document.getElementById('canvas');
+ var image = document.getElementById('image');
+
+ if (image.complete) {
+ start.call(image);
+ } else {
+ image.onload = start;
+ }
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/cropper-in-modal.html b/library/cropperjs/examples/cropper-in-modal.html
new file mode 100644
index 000000000..a9ce3e80b
--- /dev/null
+++ b/library/cropperjs/examples/cropper-in-modal.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .img-container img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper in a Bootstrap modal</h1>
+
+ <!-- Button trigger modal -->
+ <button type="button" class="btn btn-primary" data-target="#modal" data-toggle="modal">
+ Launch the demo
+ </button>
+
+ <!-- Modal -->
+ <div class="modal fade" id="modal" role="dialog" aria-labelledby="modalLabel" tabindex="-1">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="modalLabel">Cropper</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <div class="img-container">
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.getElementById('image');
+ var cropBoxData;
+ var canvasData;
+ var cropper;
+
+ $('#modal').on('shown.bs.modal', function () {
+ cropper = new Cropper(image, {
+ autoCropArea: 0.5,
+ ready: function () {
+
+ // Strict mode: set crop box data first
+ cropper.setCropBoxData(cropBoxData).setCanvasData(canvasData);
+ }
+ });
+ }).on('hidden.bs.modal', function () {
+ cropBoxData = cropper.getCropBoxData();
+ canvasData = cropper.getCanvasData();
+ cropper.destroy();
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/customize-preview.html b/library/cropperjs/examples/customize-preview.html
new file mode 100644
index 000000000..ea1c24b88
--- /dev/null
+++ b/library/cropperjs/examples/customize-preview.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 960px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ .row,
+ .preview {
+ overflow: hidden;
+ }
+
+ .col {
+ float: left;
+ }
+
+ .col-6 {
+ width: 50%;
+ }
+
+ .col-3 {
+ width: 25%;
+ }
+
+ .col-2 {
+ width: 16.7%;
+ }
+
+ .col-1 {
+ width: 8.3%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Customize preview for Cropper</h1>
+ <div class="row">
+ <div class="col col-6">
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <div class="col col-3">
+ <div class="preview"></div>
+ </div>
+ <div class="col col-2">
+ <div class="preview"></div>
+ </div>
+ <div class="col col-1">
+ <div class="preview"></div>
+ </div>
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ function each(arr, callback) {
+ var length = arr.length;
+ var i;
+
+ for (i = 0; i < length; i++) {
+ callback.call(arr, arr[i], i, arr);
+ }
+
+ return arr;
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var previews = document.querySelectorAll('.preview');
+ var cropper = new Cropper(image, {
+ ready: function () {
+ var clone = this.cloneNode();
+
+ clone.className = ''
+ clone.style.cssText = (
+ 'display: block;' +
+ 'width: 100%;' +
+ 'min-width: 0;' +
+ 'min-height: 0;' +
+ 'max-width: none;' +
+ 'max-height: none;'
+ );
+
+ each(previews, function (elem) {
+ elem.appendChild(clone.cloneNode());
+ });
+ },
+
+ crop: function (e) {
+ var data = e.detail;
+ var cropper = this.cropper;
+ var imageData = cropper.getImageData();
+ var previewAspectRatio = data.width / data.height;
+
+ each(previews, function (elem) {
+ var previewImage = elem.getElementsByTagName('img').item(0);
+ var previewWidth = elem.offsetWidth;
+ var previewHeight = previewWidth / previewAspectRatio;
+ var imageScaledRatio = data.width / previewWidth;
+
+ elem.style.height = previewHeight + 'px';
+ previewImage.style.width = imageData.naturalWidth / imageScaledRatio + 'px';
+ previewImage.style.height = imageData.naturalHeight / imageScaledRatio + 'px';
+ previewImage.style.marginLeft = -data.x / imageScaledRatio + 'px';
+ previewImage.style.marginTop = -data.y / imageScaledRatio + 'px';
+ });
+ }
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/fixed-crop-box.html b/library/cropperjs/examples/fixed-crop-box.html
new file mode 100644
index 000000000..b9f1101fb
--- /dev/null
+++ b/library/cropperjs/examples/fixed-crop-box.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with fixed crop box</h1>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var cropper = new Cropper(image, {
+ dragMode: 'move',
+ aspectRatio: 16 / 9,
+ autoCropArea: 0.65,
+ restore: false,
+ guides: false,
+ center: false,
+ highlight: false,
+ cropBoxMovable: false,
+ cropBoxResizable: false,
+ toggleDragModeOnDblclick: false,
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/full-crop-box.html b/library/cropperjs/examples/full-crop-box.html
new file mode 100644
index 000000000..7065eab94
--- /dev/null
+++ b/library/cropperjs/examples/full-crop-box.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with full crop box</h1>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var cropper = new Cropper(image, {
+ viewMode: 3,
+ dragMode: 'move',
+ autoCropArea: 1,
+ restore: false,
+ modal: false,
+ guides: false,
+ highlight: false,
+ cropBoxMovable: false,
+ cropBoxResizable: false,
+ toggleDragModeOnDblclick: false,
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/mask-an-image.html b/library/cropperjs/examples/mask-an-image.html
new file mode 100644
index 000000000..d821da43b
--- /dev/null
+++ b/library/cropperjs/examples/mask-an-image.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ .cropper-view-box,
+ .cropper-face {
+ background-color: black;
+ opacity: 1;
+ }
+
+ </style>
+</head>
+
+<body>
+
+ <div class="container">
+ <h1>Mask an image (Redaction)</h1>
+ <h3>Image</h3>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Result</h3>
+ <p><button type="button" id="button">Mask</button></p>
+ <div id="result"></div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ (function () {
+
+ function getMaskedCanvas(sourceCanvas, sourceImage, cropper) {
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+
+ var maskWidth = cropper.getData().width;
+ var maskHeight = cropper.getData().height;
+ var maskTop = cropper.getData().y;
+ var maskLeft = cropper.getData().x;
+
+ var imageWidth = cropper.getImageData().naturalWidth;
+ var imageHeight = cropper.getImageData().naturalHeight;
+ var imageLeft = cropper.getImageData().left;
+ var imageTop = cropper.getImageData().top;
+ var imageAspect = cropper.getImageData().aspectRatio;
+
+ canvas.width = imageWidth;
+ canvas.height = imageHeight;
+
+ // debug
+ console.log('Image Width: ' + imageWidth + ' Image Height: ' + imageHeight + ' Image Aspect Ratio: ' + imageAspect );
+ console.log('Image Left: ' + imageLeft + ' Image Top: ' + imageTop );
+ console.log('Mask Width: ' + maskWidth + ' Mask Height: ' + maskHeight + ' Mask Left: ' + maskLeft + ' Mask Top: ' + maskTop);
+
+ context.imageSmoothingEnabled = true;
+ context.drawImage(image, 0, 0, imageWidth, imageHeight);
+ context.fillRect(maskLeft, maskTop, maskWidth, maskHeight);
+
+ return canvas;
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.getElementById('image');
+ var button = document.getElementById('button');
+ var result = document.getElementById('result');
+ var croppable = false;
+ var cropper = new Cropper(image, {
+ viewMode: 0,
+ guides: true,
+ center: true,
+ highlight: true,
+ cropBoxMovable: true,
+ cropBoxResizable: true,
+ ready: function () {
+ croppable = true;
+ }
+ });
+
+ button.onclick = function () {
+ var croppedCanvas;
+ var roundedCanvas;
+ var roundedImage;
+
+ if (!croppable) {
+ return;
+ }
+
+ // Crop
+ croppedCanvas = cropper.getCroppedCanvas();
+
+ // Mask
+ maskedCanvas = getMaskedCanvas(croppedCanvas, image, cropper);
+
+ // Show
+ maskedImage = document.createElement('img');
+ maskedImage.src = maskedCanvas.toDataURL()
+ result.innerHTML = '';
+ result.appendChild(maskedImage);
+
+ };
+
+ });
+
+ })();
+
+ </script>
+</body>
+
+</html>
diff --git a/library/cropperjs/examples/multiple-croppers.html b/library/cropperjs/examples/multiple-croppers.html
new file mode 100644
index 000000000..6b12e70b2
--- /dev/null
+++ b/library/cropperjs/examples/multiple-croppers.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Multiple Croppers</h1>
+ <h3>Cropper</h3>
+ <div>
+ <img src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Another</h3>
+ <div>
+ <img src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var images = document.querySelectorAll('img');
+ var length = images.length;
+ var croppers = [];
+ var i;
+
+ for (i = 0; i < length; i++) {
+ croppers.push(new Cropper(images[i]));
+ }
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/responsive-container.html b/library/cropperjs/examples/responsive-container.html
new file mode 100644
index 000000000..c1aa7483b
--- /dev/null
+++ b/library/cropperjs/examples/responsive-container.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with responsive container</h1>
+ <p>
+ <button type="button" id="replace">Replace Image</button>
+ </p>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var cropper = new Cropper(image, {
+ movable: false,
+ zoomable: false,
+ rotatable: false,
+ scalable: false
+ });
+
+ document.getElementById('replace').onclick = function () {
+ cropper.replace('../docs/images/picture-2.jpg');
+ };
+ });
+ </script>
+</body>
+</html>