123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- <!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="{$package_host}font/font.css">
- <link rel="stylesheet" href="{$package_host}bootstrap/css/bootstrap.min.css">
- <link rel="stylesheet" href="{$package_host}cropper/cropper.min.css">
- <link rel="stylesheet" href="{$package_host}cropper/main.css">
- <script>var config = {};config.host = '{$data['submit']}';var aspectRatioValue = '{$data['ratio']}'</script>
- </head>
- <body>
- <!-- Content -->
- <div class="container">
- <div class="row">
- <div class="col-md-9">
- <!-- <h3>Demo:</h3> -->
- <div class="img-container">
- <img src="{$data['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="position: absolute;left:160px">
- <table border="1">
- <tr>
- <td width="30%">X</td>
- <td width="60%"><span id="dataX_text"></span></td>
- </tr>
- <tr>
- <td>Y</td>
- <td><span id="dataY_text"></span></td>
- </tr>
- <tr>
- <td>W</td>
- <td><span id="dataWidth_text"></span></td>
- </tr>
- <tr>
- <td>H</td>
- <td><span id="dataHeight_text"></span></td>
- </tr>
-
- <tr>
- <td>R</td>
- <td><span id="dataRotate_text"></span></td>
- </tr>
- <tr>
- <td>SX</td>
- <td><span id="dataScaleX_text"></span></td>
- </tr>
- <tr>
- <td>SY</td>
- <td><span id="dataScaleY_text"></span></td>
- </tr>
- </table>
- </div>
- <div class="docs-data" style="display: none;position: absolute;left:150px">
- <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="拖动">
- <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="裁剪">
- <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="放大">
- <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="缩小">
- <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="左移">
- <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="右移">
- <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="上移">
- <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="下移">
- <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="左旋转">
- <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="右旋转">
- <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="左右镜像">
- <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="上下镜像">
- <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="添加">
- <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="移除">
- <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="禁用">
- <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="解除">
- <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>
- <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="{$data['ratio']}">
- <span class="docs-tooltip" data-toggle="tooltip" title="{$data['wh']}">
- 当前
- </span>
- </button>
- <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="NAN">
- <span class="docs-tooltip" data-toggle="tooltip" title="自定义">
- 自定义
- </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="保存">
- 保存
- </span>
- </button>
- <button type="button" class="btn btn-primary" data-method="del" title="del" style="display: none">
- <span class="docs-tooltip" data-toggle="tooltip" title="删除">
- 删除
- </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>
- <input type="hidden" value="{$data['param']}" name="param" id="param" />
- <input type="hidden" value="{$data['id']}" name="id" id="id" />
- <input type="hidden" value="{$data['state']}" name="state" id="state" />
- <input type="hidden" value="{$data['group_id']}" name="group_id" id="group_id" />
- <input type="hidden" value="{$data['user_id']}" name="user_id" id="user_id" />
- <input type="hidden" value="{$data['name']}" name="name" id="name" />
- <input type="hidden" value="{$data['type']}" name="type" id="type" />
- <!-- Scripts -->
- <script src="{$package_host}jquery/jquery.min.js"></script>
- <script src="{$package_host}bootstrap/js/bootstrap.min.js"></script>
- <script src="{$package_host}cropper/cropper.js"></script>
- <script src="{$package_host}cropper/main.js?v6"></script>
- </body>
- </html>
|