|
@@ -0,0 +1,346 @@
|
|
|
+<!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">
|
|
|
+ <meta name="description" content="JavaScript image cropper.">
|
|
|
+ <title>图片裁剪工具</title>
|
|
|
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
|
|
|
+ <link rel="stylesheet" href="<{Dever::assets('lib/bootstrap/css/bootstrap.min.css', 'script')}>">
|
|
|
+ <link rel="stylesheet" href="<{Dever::assets('lib/cropper/cropper.min.css', 'script')}>">
|
|
|
+ <link rel="stylesheet" href="<{Dever::assets('lib/cropper/main.css', 'script')}>">
|
|
|
+ <script><{Dever::script()}></script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <!-- Content -->
|
|
|
+ <div class="container">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-9">
|
|
|
+ <!-- <h3>Demo:</h3> -->
|
|
|
+ <div class="img-container">
|
|
|
+ <img src="<{$pic}>" alt="Picture">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-3">
|
|
|
+ <!-- <h3>Preview:</h3> -->
|
|
|
+ <div class="docs-preview clearfix" style="height: 160px;">
|
|
|
+ <div class="img-preview preview-lg"></div>
|
|
|
+ <div class="img-preview preview-md"></div>
|
|
|
+ <div class="img-preview preview-sm"></div>
|
|
|
+ <div class="img-preview preview-xs"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- <h3>Data:</h3> -->
|
|
|
+ <div class="docs-data" style="display: none;">
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataX">X</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataX" placeholder="x">
|
|
|
+ <span class="input-group-append">
|
|
|
+ <span class="input-group-text">px</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataY">Y</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataY" placeholder="y">
|
|
|
+ <span class="input-group-append">
|
|
|
+ <span class="input-group-text">px</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataWidth">Width</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataWidth" placeholder="width">
|
|
|
+ <span class="input-group-append">
|
|
|
+ <span class="input-group-text">px</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataHeight">Height</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataHeight" placeholder="height">
|
|
|
+ <span class="input-group-append">
|
|
|
+ <span class="input-group-text">px</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataRotate">Rotate</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataRotate" placeholder="rotate">
|
|
|
+ <span class="input-group-append">
|
|
|
+ <span class="input-group-text">deg</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataScaleX">ScaleX</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataScaleX" placeholder="scaleX">
|
|
|
+ </div>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <span class="input-group-prepend">
|
|
|
+ <label class="input-group-text" for="dataScaleY">ScaleY</label>
|
|
|
+ </span>
|
|
|
+ <input type="text" class="form-control" id="dataScaleY" placeholder="scaleY">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="row" id="actions">
|
|
|
+ <div class="col-md-9 docs-buttons">
|
|
|
+ <!-- <h3>Toolbar:</h3> -->
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="setDragMode" data-option="move" title="Move">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setDragMode("move")">
|
|
|
+ <span class="fa fa-arrows-alt"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="setDragMode" data-option="crop" title="Crop">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setDragMode("crop")">
|
|
|
+ <span class="fa fa-crop-alt"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="zoom" data-option="0.1" title="Zoom In">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoom(0.1)">
|
|
|
+ <span class="fa fa-search-plus"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="zoom" data-option="-0.1" title="Zoom Out">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoom(-0.1)">
|
|
|
+ <span class="fa fa-search-minus"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="move" data-option="-10" data-second-option="0" title="Move Left">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(-10, 0)">
|
|
|
+ <span class="fa fa-arrow-left"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="move" data-option="10" data-second-option="0" title="Move Right">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(10, 0)">
|
|
|
+ <span class="fa fa-arrow-right"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="-10" title="Move Up">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(0, -10)">
|
|
|
+ <span class="fa fa-arrow-up"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="10" title="Move Down">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(0, 10)">
|
|
|
+ <span class="fa fa-arrow-down"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="rotate" data-option="-45" title="Rotate Left">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotate(-45)">
|
|
|
+ <span class="fa fa-undo-alt"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="rotate" data-option="45" title="Rotate Right">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotate(45)">
|
|
|
+ <span class="fa fa-redo-alt"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="scaleX" data-option="-1" title="Flip Horizontal">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scaleX(-1)">
|
|
|
+ <span class="fa fa-arrows-alt-h"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="scaleY" data-option="-1" title="Flip Vertical">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scaleY(-1)">
|
|
|
+ <span class="fa fa-arrows-alt-v"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="crop" title="Crop">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.crop()">
|
|
|
+ <span class="fa fa-check"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="clear" title="Clear">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.clear()">
|
|
|
+ <span class="fa fa-times"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="disable" title="Disable">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.disable()">
|
|
|
+ <span class="fa fa-lock"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="enable" title="Enable">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.enable()">
|
|
|
+ <span class="fa fa-unlock"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group" style="display: none;">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="reset" title="Reset">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.reset()">
|
|
|
+ <span class="fa fa-sync-alt"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <label class="btn btn-primary btn-upload" for="inputImage" title="Upload image file">
|
|
|
+ <input type="file" class="sr-only" id="inputImage" name="file" accept="image/*">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="Import image with Blob URLs">
|
|
|
+ <span class="fa fa-upload"></span>
|
|
|
+ </span>
|
|
|
+ </label>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="destroy" title="Destroy">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.destroy()">
|
|
|
+ <span class="fa fa-power-off"></span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="16:9">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="16:9">
|
|
|
+ 16:9
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="4:3">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="16:9">
|
|
|
+ 4:3
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="2:3">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="2:3">
|
|
|
+ 2:3
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div><div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="1:1">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="1:1">
|
|
|
+ 1:1
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-group">
|
|
|
+ <button type="button" class="btn btn-primary" data-method="save" title="save">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="16:9">
|
|
|
+ 保存
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div style="display: none;">
|
|
|
+
|
|
|
+ <!-- Show the cropped image in modal -->
|
|
|
+ <div class="modal fade docs-cropped" id="getCroppedCanvasModal" role="dialog" aria-hidden="true" aria-labelledby="getCroppedCanvasTitle" tabindex="-1">
|
|
|
+ <div class="modal-dialog">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title" id="getCroppedCanvasTitle">Cropped</h5>
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span aria-hidden="true">×</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body"></div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
|
+ <a class="btn btn-primary" id="download" href="javascript:void(0);" download="cropped.jpg">Download</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div><!-- /.modal -->
|
|
|
+
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="getData" data-option data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getData()">
|
|
|
+ Get Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="setData" data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setData(data)">
|
|
|
+ Set Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="getContainerData" data-option data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getContainerData()">
|
|
|
+ Get Container Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="getImageData" data-option data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getImageData()">
|
|
|
+ Get Image Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="getCanvasData" data-option data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCanvasData()">
|
|
|
+ Get Canvas Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="setCanvasData" data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setCanvasData(data)">
|
|
|
+ Set Canvas Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="getCropBoxData" data-option data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCropBoxData()">
|
|
|
+ Get Crop Box Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="setCropBoxData" data-target="#putData">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setCropBoxData(data)">
|
|
|
+ Set Crop Box Data
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="moveTo" data-option="0">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.moveTo(0)">
|
|
|
+ Move to [0,0]
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="zoomTo" data-option="1">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoomTo(1)">
|
|
|
+ Zoom to 100%
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="rotateTo" data-option="180">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotateTo(180)">
|
|
|
+ Rotate 180°
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-method="scale" data-option="-2" data-second-option="-1">
|
|
|
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scale(-2, -1)">
|
|
|
+ Scale (-2, -1)
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <textarea class="form-control" id="putData" placeholder="Get data to here or set data with this value"></textarea>
|
|
|
+ </div>
|
|
|
+ </div><!-- /.docs-buttons -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- Scripts -->
|
|
|
+ <script src="<{Dever::assets('lib/jquery/jquery.min.js', 'script')}>"></script>
|
|
|
+ <script src="<{Dever::assets('lib/bootstrap/js/bootstrap.min.js', 'script')}>"></script>
|
|
|
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
|
|
|
+ <script src="<{Dever::assets('lib/cropper/cropper.min.js', 'script')}>"></script>
|
|
|
+ <script src="<{Dever::assets('lib/cropper/main.js', 'script')}>"></script>
|
|
|
+</body>
|
|
|
+</html>
|