set.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="x-ua-compatible" content="ie=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <meta name="description" content="JavaScript image cropper.">
  8. <title>图片裁剪工具</title>
  9. <link rel="stylesheet" href="{$package_host}font/font.css">
  10. <link rel="stylesheet" href="{$package_host}bootstrap/css/bootstrap.min.css">
  11. <link rel="stylesheet" href="{$package_host}cropper/cropper.min.css">
  12. <link rel="stylesheet" href="{$package_host}cropper/main.css">
  13. <script>var config = {};config.host = '{$data['submit']}';var aspectRatioValue = '{$data['ratio']}'</script>
  14. </head>
  15. <body>
  16. <!-- Content -->
  17. <div class="container">
  18. <div class="row">
  19. <div class="col-md-9">
  20. <!-- <h3>Demo:</h3> -->
  21. <div class="img-container">
  22. <img src="{$data['pic']}" alt="Picture">
  23. </div>
  24. </div>
  25. <div class="col-md-3">
  26. <!-- <h3>Preview:</h3> -->
  27. <div class="docs-preview clearfix" style="height: 160px;">
  28. <div class="img-preview preview-lg"></div>
  29. <div class="img-preview preview-md"></div>
  30. <div class="img-preview preview-sm"></div>
  31. <div class="img-preview preview-xs"></div>
  32. </div>
  33. <!-- <h3>Data:</h3> -->
  34. <div class="docs-data" style="position: absolute;left:160px">
  35. <table border="1">
  36. <tr>
  37. <td width="30%">X</td>
  38. <td width="60%"><span id="dataX_text"></span></td>
  39. </tr>
  40. <tr>
  41. <td>Y</td>
  42. <td><span id="dataY_text"></span></td>
  43. </tr>
  44. <tr>
  45. <td>W</td>
  46. <td><span id="dataWidth_text"></span></td>
  47. </tr>
  48. <tr>
  49. <td>H</td>
  50. <td><span id="dataHeight_text"></span></td>
  51. </tr>
  52. <tr>
  53. <td>R</td>
  54. <td><span id="dataRotate_text"></span></td>
  55. </tr>
  56. <tr>
  57. <td>SX</td>
  58. <td><span id="dataScaleX_text"></span></td>
  59. </tr>
  60. <tr>
  61. <td>SY</td>
  62. <td><span id="dataScaleY_text"></span></td>
  63. </tr>
  64. </table>
  65. </div>
  66. <div class="docs-data" style="display: none;position: absolute;left:150px">
  67. <div class="input-group input-group-sm">
  68. <span class="input-group-prepend">
  69. <label class="input-group-text" for="dataX">X</label>
  70. </span>
  71. <input type="text" class="form-control" id="dataX" placeholder="x">
  72. <span class="input-group-append">
  73. <span class="input-group-text">px</span>
  74. </span>
  75. </div>
  76. <div class="input-group input-group-sm">
  77. <span class="input-group-prepend">
  78. <label class="input-group-text" for="dataY">Y</label>
  79. </span>
  80. <input type="text" class="form-control" id="dataY" placeholder="y">
  81. <span class="input-group-append">
  82. <span class="input-group-text">px</span>
  83. </span>
  84. </div>
  85. <div class="input-group input-group-sm">
  86. <span class="input-group-prepend">
  87. <label class="input-group-text" for="dataWidth">Width</label>
  88. </span>
  89. <input type="text" class="form-control" id="dataWidth" placeholder="width">
  90. <span class="input-group-append">
  91. <span class="input-group-text">px</span>
  92. </span>
  93. </div>
  94. <div class="input-group input-group-sm">
  95. <span class="input-group-prepend">
  96. <label class="input-group-text" for="dataHeight">Height</label>
  97. </span>
  98. <input type="text" class="form-control" id="dataHeight" placeholder="height">
  99. <span class="input-group-append">
  100. <span class="input-group-text">px</span>
  101. </span>
  102. </div>
  103. <div class="input-group input-group-sm">
  104. <span class="input-group-prepend">
  105. <label class="input-group-text" for="dataRotate">Rotate</label>
  106. </span>
  107. <input type="text" class="form-control" id="dataRotate" placeholder="rotate">
  108. <span class="input-group-append">
  109. <span class="input-group-text">deg</span>
  110. </span>
  111. </div>
  112. <div class="input-group input-group-sm">
  113. <span class="input-group-prepend">
  114. <label class="input-group-text" for="dataScaleX">ScaleX</label>
  115. </span>
  116. <input type="text" class="form-control" id="dataScaleX" placeholder="scaleX">
  117. </div>
  118. <div class="input-group input-group-sm">
  119. <span class="input-group-prepend">
  120. <label class="input-group-text" for="dataScaleY">ScaleY</label>
  121. </span>
  122. <input type="text" class="form-control" id="dataScaleY" placeholder="scaleY">
  123. </div>
  124. </div>
  125. <div class="row" id="actions">
  126. <div class="col-md-9 docs-buttons">
  127. <!-- <h3>Toolbar:</h3> -->
  128. <div class="btn-group">
  129. <button type="button" class="btn btn-primary" data-method="setDragMode" data-option="move" title="Move">
  130. <span class="docs-tooltip" data-toggle="tooltip" title="拖动">
  131. <span class="fa fa-arrows-alt"></span>
  132. </span>
  133. </button>
  134. <button type="button" class="btn btn-primary" data-method="setDragMode" data-option="crop" title="Crop">
  135. <span class="docs-tooltip" data-toggle="tooltip" title="裁剪">
  136. <span class="fa fa-crop-alt"></span>
  137. </span>
  138. </button>
  139. </div>
  140. <div class="btn-group">
  141. <button type="button" class="btn btn-primary" data-method="zoom" data-option="0.1" title="Zoom In">
  142. <span class="docs-tooltip" data-toggle="tooltip" title="放大">
  143. <span class="fa fa-search-plus"></span>
  144. </span>
  145. </button>
  146. <button type="button" class="btn btn-primary" data-method="zoom" data-option="-0.1" title="Zoom Out">
  147. <span class="docs-tooltip" data-toggle="tooltip" title="缩小">
  148. <span class="fa fa-search-minus"></span>
  149. </span>
  150. </button>
  151. </div>
  152. <div class="btn-group">
  153. <button type="button" class="btn btn-primary" data-method="move" data-option="-10" data-second-option="0" title="Move Left">
  154. <span class="docs-tooltip" data-toggle="tooltip" title="左移">
  155. <span class="fa fa-arrow-left"></span>
  156. </span>
  157. </button>
  158. <button type="button" class="btn btn-primary" data-method="move" data-option="10" data-second-option="0" title="Move Right">
  159. <span class="docs-tooltip" data-toggle="tooltip" title="右移">
  160. <span class="fa fa-arrow-right"></span>
  161. </span>
  162. </button>
  163. <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="-10" title="Move Up">
  164. <span class="docs-tooltip" data-toggle="tooltip" title="上移">
  165. <span class="fa fa-arrow-up"></span>
  166. </span>
  167. </button>
  168. <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="10" title="Move Down">
  169. <span class="docs-tooltip" data-toggle="tooltip" title="下移">
  170. <span class="fa fa-arrow-down"></span>
  171. </span>
  172. </button>
  173. </div>
  174. <div class="btn-group">
  175. <button type="button" class="btn btn-primary" data-method="rotate" data-option="-45" title="Rotate Left">
  176. <span class="docs-tooltip" data-toggle="tooltip" title="左旋转">
  177. <span class="fa fa-undo-alt"></span>
  178. </span>
  179. </button>
  180. <button type="button" class="btn btn-primary" data-method="rotate" data-option="45" title="Rotate Right">
  181. <span class="docs-tooltip" data-toggle="tooltip" title="右旋转">
  182. <span class="fa fa-redo-alt"></span>
  183. </span>
  184. </button>
  185. </div>
  186. <div class="btn-group">
  187. <button type="button" class="btn btn-primary" data-method="scaleX" data-option="-1" title="Flip Horizontal">
  188. <span class="docs-tooltip" data-toggle="tooltip" title="左右镜像">
  189. <span class="fa fa-arrows-alt-h"></span>
  190. </span>
  191. </button>
  192. <button type="button" class="btn btn-primary" data-method="scaleY" data-option="-1" title="Flip Vertical">
  193. <span class="docs-tooltip" data-toggle="tooltip" title="上下镜像">
  194. <span class="fa fa-arrows-alt-v"></span>
  195. </span>
  196. </button>
  197. </div>
  198. <div class="btn-group">
  199. <button type="button" class="btn btn-primary" data-method="crop" title="Crop">
  200. <span class="docs-tooltip" data-toggle="tooltip" title="添加">
  201. <span class="fa fa-check"></span>
  202. </span>
  203. </button>
  204. <button type="button" class="btn btn-primary" data-method="clear" title="Clear">
  205. <span class="docs-tooltip" data-toggle="tooltip" title="移除">
  206. <span class="fa fa-times"></span>
  207. </span>
  208. </button>
  209. </div>
  210. <div class="btn-group">
  211. <button type="button" class="btn btn-primary" data-method="disable" title="Disable">
  212. <span class="docs-tooltip" data-toggle="tooltip" title="禁用">
  213. <span class="fa fa-lock"></span>
  214. </span>
  215. </button>
  216. <button type="button" class="btn btn-primary" data-method="enable" title="Enable">
  217. <span class="docs-tooltip" data-toggle="tooltip" title="解除">
  218. <span class="fa fa-unlock"></span>
  219. </span>
  220. </button>
  221. </div>
  222. <div class="btn-group" style="display: none;">
  223. <button type="button" class="btn btn-primary" data-method="reset" title="Reset">
  224. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.reset()">
  225. <span class="fa fa-sync-alt"></span>
  226. </span>
  227. </button>
  228. <label class="btn btn-primary btn-upload" for="inputImage" title="Upload image file">
  229. <input type="file" class="sr-only" id="inputImage" name="file" accept="image/*">
  230. <span class="docs-tooltip" data-toggle="tooltip" title="Import image with Blob URLs">
  231. <span class="fa fa-upload"></span>
  232. </span>
  233. </label>
  234. <button type="button" class="btn btn-primary" data-method="destroy" title="Destroy">
  235. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.destroy()">
  236. <span class="fa fa-power-off"></span>
  237. </span>
  238. </button>
  239. </div>
  240. <div class="btn-group">
  241. <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="16:9">
  242. <span class="docs-tooltip" data-toggle="tooltip" title="16:9">
  243. 16:9
  244. </span>
  245. </button>
  246. <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="4:3">
  247. <span class="docs-tooltip" data-toggle="tooltip" title="16:9">
  248. 4:3
  249. </span>
  250. </button>
  251. <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="2:3">
  252. <span class="docs-tooltip" data-toggle="tooltip" title="2:3">
  253. 2:3
  254. </span>
  255. </button>
  256. </div><div class="btn-group">
  257. <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="1:1">
  258. <span class="docs-tooltip" data-toggle="tooltip" title="1:1">
  259. 1:1
  260. </span>
  261. </button>
  262. <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="{$data['ratio']}">
  263. <span class="docs-tooltip" data-toggle="tooltip" title="{$data['wh']}">
  264. 当前
  265. </span>
  266. </button>
  267. <button type="button" class="btn btn-primary" data-method="aspectRatio" title="Reset" data-value="NAN">
  268. <span class="docs-tooltip" data-toggle="tooltip" title="自定义">
  269. 自定义
  270. </span>
  271. </button>
  272. </div>
  273. <div class="btn-group">
  274. <button type="button" class="btn btn-primary" data-method="save" title="save">
  275. <span class="docs-tooltip" data-toggle="tooltip" title="保存">
  276. 保存
  277. </span>
  278. </button>
  279. <button type="button" class="btn btn-primary" data-method="del" title="del" style="display: none">
  280. <span class="docs-tooltip" data-toggle="tooltip" title="删除">
  281. 删除
  282. </span>
  283. </button>
  284. </div>
  285. <div style="display: none;">
  286. <!-- Show the cropped image in modal -->
  287. <div class="modal fade docs-cropped" id="getCroppedCanvasModal" role="dialog" aria-hidden="true" aria-labelledby="getCroppedCanvasTitle" tabindex="-1">
  288. <div class="modal-dialog">
  289. <div class="modal-content">
  290. <div class="modal-header">
  291. <h5 class="modal-title" id="getCroppedCanvasTitle">Cropped</h5>
  292. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  293. <span aria-hidden="true">&times;</span>
  294. </button>
  295. </div>
  296. <div class="modal-body"></div>
  297. <div class="modal-footer">
  298. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  299. <a class="btn btn-primary" id="download" href="javascript:void(0);" download="cropped.jpg">Download</a>
  300. </div>
  301. </div>
  302. </div>
  303. </div><!-- /.modal -->
  304. <button type="button" class="btn btn-secondary" data-method="getData" data-option data-target="#putData">
  305. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getData()">
  306. Get Data
  307. </span>
  308. </button>
  309. <button type="button" class="btn btn-secondary" data-method="setData" data-target="#putData">
  310. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setData(data)">
  311. Set Data
  312. </span>
  313. </button>
  314. <button type="button" class="btn btn-secondary" data-method="getContainerData" data-option data-target="#putData">
  315. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getContainerData()">
  316. Get Container Data
  317. </span>
  318. </button>
  319. <button type="button" class="btn btn-secondary" data-method="getImageData" data-option data-target="#putData">
  320. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getImageData()">
  321. Get Image Data
  322. </span>
  323. </button>
  324. <button type="button" class="btn btn-secondary" data-method="getCanvasData" data-option data-target="#putData">
  325. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCanvasData()">
  326. Get Canvas Data
  327. </span>
  328. </button>
  329. <button type="button" class="btn btn-secondary" data-method="setCanvasData" data-target="#putData">
  330. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setCanvasData(data)">
  331. Set Canvas Data
  332. </span>
  333. </button>
  334. <button type="button" class="btn btn-secondary" data-method="getCropBoxData" data-option data-target="#putData">
  335. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCropBoxData()">
  336. Get Crop Box Data
  337. </span>
  338. </button>
  339. <button type="button" class="btn btn-secondary" data-method="setCropBoxData" data-target="#putData">
  340. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setCropBoxData(data)">
  341. Set Crop Box Data
  342. </span>
  343. </button>
  344. <button type="button" class="btn btn-secondary" data-method="moveTo" data-option="0">
  345. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.moveTo(0)">
  346. Move to [0,0]
  347. </span>
  348. </button>
  349. <button type="button" class="btn btn-secondary" data-method="zoomTo" data-option="1">
  350. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoomTo(1)">
  351. Zoom to 100%
  352. </span>
  353. </button>
  354. <button type="button" class="btn btn-secondary" data-method="rotateTo" data-option="180">
  355. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotateTo(180)">
  356. Rotate 180°
  357. </span>
  358. </button>
  359. <button type="button" class="btn btn-secondary" data-method="scale" data-option="-2" data-second-option="-1">
  360. <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scale(-2, -1)">
  361. Scale (-2, -1)
  362. </span>
  363. </button>
  364. <textarea class="form-control" id="putData" placeholder="Get data to here or set data with this value"></textarea>
  365. </div>
  366. </div><!-- /.docs-buttons -->
  367. </div>
  368. </div>
  369. </div>
  370. </div>
  371. <input type="hidden" value="{$data['param']}" name="param" id="param" />
  372. <input type="hidden" value="{$data['id']}" name="id" id="id" />
  373. <input type="hidden" value="{$data['state']}" name="state" id="state" />
  374. <input type="hidden" value="{$data['group_id']}" name="group_id" id="group_id" />
  375. <input type="hidden" value="{$data['user_id']}" name="user_id" id="user_id" />
  376. <input type="hidden" value="{$data['name']}" name="name" id="name" />
  377. <input type="hidden" value="{$data['type']}" name="type" id="type" />
  378. <!-- Scripts -->
  379. <script src="{$package_host}jquery/jquery.min.js"></script>
  380. <script src="{$package_host}bootstrap/js/bootstrap.min.js"></script>
  381. <script src="{$package_host}cropper/cropper.js"></script>
  382. <script src="{$package_host}cropper/main.js?v6"></script>
  383. </body>
  384. </html>