├── demo ├── image_cropper │ ├── icons.png │ ├── degree_slider.png │ ├── cropperjs-1.5.6 │ │ ├── LICENSE │ │ ├── dist │ │ │ ├── cropper.min.css │ │ │ ├── cropper.css │ │ │ └── cropper.min.js │ │ └── README.md │ ├── image_cropper.css │ └── image_cropper.js ├── demo.css ├── index.html └── demo.js ├── .gitignore ├── SlashUploader ├── server │ ├── uploads │ │ └── readme.md │ ├── Web.config │ ├── readme.md │ └── UploadFiles.aspx ├── iframe_gateway.html ├── SlashUploader.min.css └── SlashUploader.src.css ├── LICENSE └── README.md /demo/image_cropper/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slashapps/SlashUploader/HEAD/demo/image_cropper/icons.png -------------------------------------------------------------------------------- /demo/image_cropper/degree_slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slashapps/SlashUploader/HEAD/demo/image_cropper/degree_slider.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | SlashUploader.code-workspace 2 | compile/ 3 | SlashUploader/server/uploads/* 4 | !SlashUploader/serveruploads/README.md 5 | -------------------------------------------------------------------------------- /SlashUploader/server/uploads/readme.md: -------------------------------------------------------------------------------- 1 | ## Uploads Folder 2 | 3 | Folder to store user's uploaded files. 4 | Make sure to give "uploads" folder on your server read & write permissions. -------------------------------------------------------------------------------- /SlashUploader/server/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SlashUploader/server/readme.md: -------------------------------------------------------------------------------- 1 | # Server Script (for Windows server) 2 | 3 | ## Web.config 4 | 5 | Current web.config files allows to upload big files. 6 | In order for the web.config file to take effect - folder must be Application Pool on server, or web.config file should be located on current Application Pool root. 7 | 8 | ## Uploads Folder 9 | 10 | Folder to store user's uploaded files. 11 | Make sure to give "uploads" folder on your server read & write permissions. 12 | 13 | ## Security 14 | 15 | Example code limits file types based on file extenstion. 16 | However, it is highly recomanded to use AntiVirus software on your server - allowing users to upload files and view them represent a significant security risk. 17 | Make sure to secure your Application and server with all means necessary. 18 | More information here: https://www.owasp.org/index.php/Unrestricted_File_Upload. 19 | -------------------------------------------------------------------------------- /demo/image_cropper/cropperjs-1.5.6/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2015-present Chen Fengyuan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-present Slash Apps Development (http://slash.co.il) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SlashUploader 2 | 3 | Javascript multi-features plugin to upload files - with cross-domain support, legacy browsers compatibility, fully-customizable design, and many more options. 4 | 5 | **To get started, visit https://slashuploader.com** 6 | 7 | Check out some of our [demos](https://slashuploader.com#demos). 8 | 9 | 10 | ## Features 11 | 12 | The plugin contain the following features: 13 | * **Cross-Domain** - Upload files to a cross-domain script, on all browsers. 14 | * **Old Browsers Support** - Support very old browsers, such as IE8. 15 | * **Preview Images** - See image preview within the plugin progress indication. 16 | * **Drag & Drop** - Select files by dragging them. 17 | * **Get Files Metadata** - Get files metadata upon files selection. 18 | * **Fully Customizable** - Plenty of options to use, with the ability to change the plugin CSS easily, or to simpley use the plugin over you own custom HTML element. 19 | * **RTL** - Display with Right-to-Left direction. 20 | * **Validate Before Upload** - Fully-customizable validation. 21 | * **Show Upload Progress** - See upload progress on almost all browsers. 22 | * **Trigger Events** - Use events such as files selected, progess, finished, ect. 23 | * **Dynamic Options** - Plugin options can be set any time, not only at initialization. 24 | * **Cancel Upload** - Button for the user to abort. 25 | * **Ability to Disable** - Disable user interaction. 26 | * **Compress Images** - Resize image before upload, for a faster progress. 27 | 28 | ## Compatibility 29 | 30 | Full browsers compatibility list can be seen here: https://slashuploader.com#docs 31 | 32 | ## Documentation 33 | 34 | Full documentation can be seen here: https://slashuploader.com#docs 35 | -------------------------------------------------------------------------------- /SlashUploader/iframe_gateway.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /demo/demo.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; 4 | } 5 | 6 | .uploader_field_container { 7 | background: #F7F7F7; 8 | border: 1px solid #CCC; 9 | border-radius: 2px; 10 | vertical-align: top; 11 | } 12 | 13 | .uploader_field { 14 | /*width: 450px;*/ 15 | } 16 | 17 | #uploader_field3, 18 | #uploader_field4 { 19 | height: 70px; 20 | } 21 | 22 | .uploader_status { 23 | vertical-align: top; 24 | font-size: 12px; 25 | } 26 | 27 | .custom_html { 28 | width: 120px; 29 | height: auto; 30 | border: 2px solid red; 31 | transition: all 0.5s; 32 | -webkit-transition: all 0.5s; 33 | } 34 | 35 | .custom_html.hover { 36 | background-color: tomato; 37 | } 38 | 39 | .custom_html.dragged_enter { 40 | border: 2px dashed red; 41 | background-color: white; 42 | } 43 | 44 | .custom_html.dragged_over { 45 | border: 2px dashed tomato; 46 | background-color: #ffcaca; 47 | } 48 | 49 | .custom_html.uploading { 50 | opacity: 0.5; 51 | } 52 | 53 | 54 | .custom_css .uploader_drop_area { 55 | border: 2px solid green; 56 | color: green; 57 | } 58 | 59 | .custom_css.hover .uploader_drop_area { 60 | background: #93c293; 61 | color: white; 62 | } 63 | 64 | .custom_css.dragged_enter .uploader_drop_area { 65 | background: #296d29; 66 | color: white; 67 | border: 2px dashed white; 68 | } 69 | 70 | .custom_css.dragged_over .uploader_drop_area { 71 | background: #0c510c; 72 | color: white; 73 | border: 2px dashed white; 74 | } 75 | 76 | .custom_css.uploading .uploader_text span { 77 | font-weight: bold; 78 | } 79 | 80 | .custom_css .uploader_drop_area_bottom { 81 | background: #97e497; 82 | } 83 | 84 | .custom_css .uploader_spinner { 85 | border: 2px solid green; 86 | border-right: 2px solid rgba(0, 255, 0, 0.25); 87 | border-bottom: 2px solid rgba(0, 255, 0, 0.25); 88 | border-left: 2px solid rgba(0, 255, 0, 0.25); 89 | } 90 | 91 | .custom_css .uploader_result_file a { 92 | color: green; 93 | } 94 | 95 | .custom_css .uploader_progress_container .uploader_progress_bar>div>div { 96 | background: green; 97 | } 98 | 99 | .demos_table { 100 | width: 100%; 101 | } 102 | 103 | .demos_table .uploader_title { 104 | width: 160px; 105 | } 106 | 107 | @media (max-width: 640px) { 108 | .uploader_field { 109 | /*width: 100%;*/ 110 | } 111 | 112 | .title_th { 113 | width: 25px; 114 | } 115 | 116 | .uploader_th, 117 | .uploader_field_container { 118 | max-width: 150px; 119 | } 120 | 121 | .status_th { 122 | width: 55px; 123 | } 124 | 125 | .slash_uploader.uploading .uploader_drop_area .uploader_text .uploader_text_container, 126 | .slash_uploader .uploader_drop_area .uploader_cancel span { 127 | line-height: 14px; 128 | font-size: 11px; 129 | } 130 | } 131 | 132 | @media (min-width: 1000px) { 133 | 134 | .uploader_field_container { 135 | width: 500px; 136 | } 137 | 138 | } -------------------------------------------------------------------------------- /demo/image_cropper/cropperjs-1.5.6/dist/cropper.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Cropper.js v1.5.6 3 | * https://fengyuanchen.github.io/cropperjs 4 | * 5 | * Copyright 2015-present Chen Fengyuan 6 | * Released under the MIT license 7 | * 8 | * Date: 2019-10-04T04:33:44.164Z 9 | */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed} -------------------------------------------------------------------------------- /demo/image_cropper/image_cropper.css: -------------------------------------------------------------------------------- 1 | /* ==== Cropper ==== */ 2 | 3 | .cropper-modal { 4 | opacity: 0.7 !important; 5 | } 6 | 7 | #cropper_popup { 8 | width: 100%; 9 | height: 100%; 10 | position: fixed; 11 | top: 0; 12 | left: 0; 13 | background-color: #737377; 14 | z-index: 300; 15 | display: none; 16 | margin: auto; 17 | text-align: center; 18 | direction: ltr; 19 | font-family: Arial, Helvetica, sans-serif; 20 | } 21 | 22 | #cropper_container { 23 | width: 100%; 24 | margin: auto; 25 | } 26 | 27 | #cropper_buttons { 28 | position: absolute; 29 | bottom: 0px; 30 | left: 0; 31 | right: 0; 32 | margin-left: auto; 33 | margin-right: auto; 34 | padding-bottom: 20px; 35 | } 36 | 37 | .cropper-container.cropper-bg { 38 | height: 100% !important; 39 | } 40 | 41 | #cropper_canvas {} 42 | 43 | #cropper_loading { 44 | /*width: 1px;*/ 45 | height: 1px; 46 | margin: auto; 47 | color: white; 48 | } 49 | 50 | #cropper_rotation_slider, 51 | #cropper_degree_slider { 52 | width: 700px; 53 | } 54 | 55 | #cropper_rotation_slider, 56 | .cropper_slides_wrapper, 57 | #cropper_degree_slider { 58 | height: 34px; 59 | } 60 | 61 | #cropper_rotation_slider { 62 | margin: 6px auto; 63 | max-width: 100%; 64 | z-index: 101; 65 | padding-bottom: 10px; 66 | } 67 | 68 | .cropper_slides_wrapper { 69 | overflow: hidden; 70 | position: relative; 71 | width: 100%; 72 | z-index: 102; 73 | -webkit-mask: linear-gradient(90deg, transparent 5%, #000 20%, #000 80%, transparent 95%); 74 | } 75 | 76 | .cropper_slides_wrapper:after { 77 | content: ""; 78 | position: absolute; 79 | z-index: -1; 80 | top: 0; 81 | bottom: 0; 82 | left: 50%; 83 | border-left: 1px solid white; 84 | transform: translate(-50%); 85 | } 86 | 87 | #cropper_slides { 88 | display: flex; 89 | position: relative; 90 | top: 0; 91 | left: -900px; 92 | width: 2200px; 93 | } 94 | 95 | #cropper_slides.shifting { 96 | transition: left .2s ease-out; 97 | } 98 | 99 | #cropper_degree_slider { 100 | cursor: grab; 101 | display: flex; 102 | flex-direction: column; 103 | justify-content: center; 104 | transition: all 1s; 105 | position: relative; 106 | border-radius: 2px; 107 | width: 2200px; 108 | opacity: 0.7; 109 | background-image: url("degree_slider.png"); 110 | background-repeat: no-repeat; 111 | } 112 | 113 | .dragging #cropper_degree_slider { 114 | cursor: grabbing; 115 | } 116 | 117 | #cropper_buttons .cropper_btn { 118 | font-size: 15px; 119 | color: white; 120 | cursor: pointer; 121 | padding-top: 8px; 122 | padding-bottom: 8px; 123 | padding-right: 8px; 124 | padding-left: 8px; 125 | display: inline-block; 126 | vertical-align: middle; 127 | transition: all .25s; 128 | -webkit-touch-callout: none; 129 | /* iOS Safari */ 130 | -webkit-user-select: none; 131 | /* Safari */ 132 | -khtml-user-select: none; 133 | /* Konqueror HTML */ 134 | -moz-user-select: none; 135 | /* Firefox */ 136 | -ms-user-select: none; 137 | /* Internet Explorer/Edge */ 138 | user-select: none; 139 | /* Non-prefixed version, currently 140 | supported by Chrome and Opera */ 141 | } 142 | 143 | /* Non-Touch device */ 144 | @media (hover: hover) { 145 | #cropper_buttons .cropper_btn:hover { 146 | background: rgba(255, 255, 255, 0.3); 147 | } 148 | } 149 | 150 | /* Touch device */ 151 | @media (hover: none) { 152 | #cropper_buttons .cropper_btn:active { 153 | background: rgba(255, 255, 255, 0.3); 154 | } 155 | 156 | #cropper_buttons .cropper_btn_flip_horizontal, 157 | #cropper_buttons .cropper_btn_flip_vertical { 158 | display: none; 159 | } 160 | 161 | } 162 | 163 | #cropper_buttons .cropper_btn span { 164 | background: url(icons.png); 165 | height: 20px; 166 | width: 25px; 167 | display: inline-block; 168 | position: relative; 169 | top: -1px; 170 | margin-right: 4px; 171 | vertical-align: middle; 172 | } 173 | 174 | #cropper_buttons .cropper_btn_resize_enlarge span { 175 | background-position: -72px 0px; 176 | } 177 | 178 | #cropper_buttons .cropper_btn_resize_reduce span { 179 | background-position: -48px 0px; 180 | } 181 | 182 | #cropper_buttons .cropper_btn_flip_horizontal span { 183 | background-position: -24px 0px; 184 | } 185 | 186 | #cropper_buttons .cropper_btn_flip_vertical span { 187 | background-position: 0px 0px; 188 | } 189 | 190 | #cropper_buttons .cropper_btn_crop span { 191 | background-position: -96px 0px; 192 | } 193 | 194 | #cropper_buttons .cropper_btn_reset span { 195 | background-position: -120px 0px; 196 | } 197 | 198 | #cropper_buttons .cropper_btn_cancel span { 199 | background-position: -144px 0px; 200 | } 201 | 202 | #cropper_buttons .cropper_btn_sep_2 { 203 | height: 20px; 204 | width: 30px; 205 | display: inline-block; 206 | } 207 | 208 | @media screen and (max-width: 820px) { 209 | #cropper_buttons .cropper_btn_sep_1 { 210 | display: block; 211 | } 212 | 213 | #cropper_buttons .cropper_btn_sep_2 { 214 | display: block; 215 | height: 0px; 216 | } 217 | } -------------------------------------------------------------------------------- /demo/image_cropper/cropperjs-1.5.6/dist/cropper.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Cropper.js v1.5.6 3 | * https://fengyuanchen.github.io/cropperjs 4 | * 5 | * Copyright 2015-present Chen Fengyuan 6 | * Released under the MIT license 7 | * 8 | * Date: 2019-10-04T04:33:44.164Z 9 | */ 10 | 11 | .cropper-container { 12 | direction: ltr; 13 | font-size: 0; 14 | line-height: 0; 15 | position: relative; 16 | -ms-touch-action: none; 17 | touch-action: none; 18 | -webkit-user-select: none; 19 | -moz-user-select: none; 20 | -ms-user-select: none; 21 | user-select: none; 22 | } 23 | 24 | .cropper-container img { 25 | display: block; 26 | height: 100%; 27 | image-orientation: 0deg; 28 | max-height: none !important; 29 | max-width: none !important; 30 | min-height: 0 !important; 31 | min-width: 0 !important; 32 | width: 100%; 33 | } 34 | 35 | .cropper-wrap-box, 36 | .cropper-canvas, 37 | .cropper-drag-box, 38 | .cropper-crop-box, 39 | .cropper-modal { 40 | bottom: 0; 41 | left: 0; 42 | position: absolute; 43 | right: 0; 44 | top: 0; 45 | } 46 | 47 | .cropper-wrap-box, 48 | .cropper-canvas { 49 | overflow: hidden; 50 | } 51 | 52 | .cropper-drag-box { 53 | background-color: #fff; 54 | opacity: 0; 55 | } 56 | 57 | .cropper-modal { 58 | background-color: #000; 59 | opacity: 0.5; 60 | } 61 | 62 | .cropper-view-box { 63 | display: block; 64 | height: 100%; 65 | outline: 1px solid #39f; 66 | outline-color: rgba(51, 153, 255, 0.75); 67 | overflow: hidden; 68 | width: 100%; 69 | } 70 | 71 | .cropper-dashed { 72 | border: 0 dashed #eee; 73 | display: block; 74 | opacity: 0.5; 75 | position: absolute; 76 | } 77 | 78 | .cropper-dashed.dashed-h { 79 | border-bottom-width: 1px; 80 | border-top-width: 1px; 81 | height: calc(100% / 3); 82 | left: 0; 83 | top: calc(100% / 3); 84 | width: 100%; 85 | } 86 | 87 | .cropper-dashed.dashed-v { 88 | border-left-width: 1px; 89 | border-right-width: 1px; 90 | height: 100%; 91 | left: calc(100% / 3); 92 | top: 0; 93 | width: calc(100% / 3); 94 | } 95 | 96 | .cropper-center { 97 | display: block; 98 | height: 0; 99 | left: 50%; 100 | opacity: 0.75; 101 | position: absolute; 102 | top: 50%; 103 | width: 0; 104 | } 105 | 106 | .cropper-center::before, 107 | .cropper-center::after { 108 | background-color: #eee; 109 | content: ' '; 110 | display: block; 111 | position: absolute; 112 | } 113 | 114 | .cropper-center::before { 115 | height: 1px; 116 | left: -3px; 117 | top: 0; 118 | width: 7px; 119 | } 120 | 121 | .cropper-center::after { 122 | height: 7px; 123 | left: 0; 124 | top: -3px; 125 | width: 1px; 126 | } 127 | 128 | .cropper-face, 129 | .cropper-line, 130 | .cropper-point { 131 | display: block; 132 | height: 100%; 133 | opacity: 0.1; 134 | position: absolute; 135 | width: 100%; 136 | } 137 | 138 | .cropper-face { 139 | background-color: #fff; 140 | left: 0; 141 | top: 0; 142 | } 143 | 144 | .cropper-line { 145 | background-color: #39f; 146 | } 147 | 148 | .cropper-line.line-e { 149 | cursor: ew-resize; 150 | right: -3px; 151 | top: 0; 152 | width: 5px; 153 | } 154 | 155 | .cropper-line.line-n { 156 | cursor: ns-resize; 157 | height: 5px; 158 | left: 0; 159 | top: -3px; 160 | } 161 | 162 | .cropper-line.line-w { 163 | cursor: ew-resize; 164 | left: -3px; 165 | top: 0; 166 | width: 5px; 167 | } 168 | 169 | .cropper-line.line-s { 170 | bottom: -3px; 171 | cursor: ns-resize; 172 | height: 5px; 173 | left: 0; 174 | } 175 | 176 | .cropper-point { 177 | background-color: #39f; 178 | height: 5px; 179 | opacity: 0.75; 180 | width: 5px; 181 | } 182 | 183 | .cropper-point.point-e { 184 | cursor: ew-resize; 185 | margin-top: -3px; 186 | right: -3px; 187 | top: 50%; 188 | } 189 | 190 | .cropper-point.point-n { 191 | cursor: ns-resize; 192 | left: 50%; 193 | margin-left: -3px; 194 | top: -3px; 195 | } 196 | 197 | .cropper-point.point-w { 198 | cursor: ew-resize; 199 | left: -3px; 200 | margin-top: -3px; 201 | top: 50%; 202 | } 203 | 204 | .cropper-point.point-s { 205 | bottom: -3px; 206 | cursor: s-resize; 207 | left: 50%; 208 | margin-left: -3px; 209 | } 210 | 211 | .cropper-point.point-ne { 212 | cursor: nesw-resize; 213 | right: -3px; 214 | top: -3px; 215 | } 216 | 217 | .cropper-point.point-nw { 218 | cursor: nwse-resize; 219 | left: -3px; 220 | top: -3px; 221 | } 222 | 223 | .cropper-point.point-sw { 224 | bottom: -3px; 225 | cursor: nesw-resize; 226 | left: -3px; 227 | } 228 | 229 | .cropper-point.point-se { 230 | bottom: -3px; 231 | cursor: nwse-resize; 232 | height: 20px; 233 | opacity: 1; 234 | right: -3px; 235 | width: 20px; 236 | } 237 | 238 | @media (min-width: 768px) { 239 | .cropper-point.point-se { 240 | height: 15px; 241 | width: 15px; 242 | } 243 | } 244 | 245 | @media (min-width: 992px) { 246 | .cropper-point.point-se { 247 | height: 10px; 248 | width: 10px; 249 | } 250 | } 251 | 252 | @media (min-width: 1200px) { 253 | .cropper-point.point-se { 254 | height: 5px; 255 | opacity: 0.75; 256 | width: 5px; 257 | } 258 | } 259 | 260 | .cropper-point.point-se::before { 261 | background-color: #39f; 262 | bottom: -50%; 263 | content: ' '; 264 | display: block; 265 | height: 200%; 266 | opacity: 0; 267 | position: absolute; 268 | right: -50%; 269 | width: 200%; 270 | } 271 | 272 | .cropper-invisible { 273 | opacity: 0; 274 | } 275 | 276 | .cropper-bg { 277 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC'); 278 | } 279 | 280 | .cropper-hide { 281 | display: block; 282 | height: 0; 283 | position: absolute; 284 | width: 0; 285 | } 286 | 287 | .cropper-hidden { 288 | display: none !important; 289 | } 290 | 291 | .cropper-move { 292 | cursor: move; 293 | } 294 | 295 | .cropper-crop { 296 | cursor: crosshair; 297 | } 298 | 299 | .cropper-disabled .cropper-drag-box, 300 | .cropper-disabled .cropper-face, 301 | .cropper-disabled .cropper-line, 302 | .cropper-disabled .cropper-point { 303 | cursor: not-allowed; 304 | } 305 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | SlashUploader Demos 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 37 | 38 | 40 | 42 | 44 | 45 | 46 | 49 | 53 | 55 | 56 | 57 | 60 | 64 | 66 | 67 | 68 | 71 | 75 | 77 | 78 | 79 | 82 | 86 | 88 | 89 | 90 | 93 | 97 | 99 | 100 | 101 | 104 | 108 | 110 | 111 | 112 | 115 | 119 | 121 | 122 | 123 | 126 | 130 | 132 | 133 | 134 | 137 | 141 | 143 | 144 | 145 | 148 | 152 | 154 | 155 | 156 | 159 | 163 | 166 | 167 | 168 | 171 | 175 | 178 | 179 | 180 | 183 | 187 | 190 | 191 | 192 | 195 | 199 | 202 | 203 | 204 | 207 | 211 | 214 | 215 | 216 | 219 | 223 | 226 | 227 | 228 | 231 | 235 | 238 | 239 | 240 | 243 | 251 | 253 | 254 | 255 | 256 | 257 |
39 | 41 | 43 |
47 | Default 48 | 50 |
51 |
52 |
54 |
58 | Single File 59 | 61 |
62 |
63 |
65 |
69 | Without metadata 70 | 72 |
73 |
74 |
76 |
80 | Disabled 81 | 83 |
84 |
85 |
87 |
91 | Pre-defined files 92 | 94 |
95 |
96 |
98 |
102 | Progress bar animation 103 | 105 |
106 |
107 |
109 |
113 | RTL 114 | 116 |
117 |
118 |
120 |
124 | Drag & Drop disabled 125 | 127 |
128 |
129 |
131 |
135 | Cancel & Delete disabled 136 | 138 |
139 |
140 |
142 |
146 | Don't show uploaded files 147 | 149 |
150 |
151 |
153 |
157 | Cross-Domain Script 158 | 160 |
161 |
162 |
164 |
165 |
169 | Validations 170 | 172 |
173 |
174 |
176 |
177 |
181 | No overwrite 182 | 184 |
185 |
186 |
188 |
189 |
193 | Auto crop 194 | 196 |
197 |
198 |
200 |
201 |
205 | Manual crop 206 | 208 |
209 |
210 |
212 |
213 |
217 | Group upload result 218 | 220 |
221 |
222 |
224 |
225 |
229 | Custom CSS 230 | 232 |
233 |
234 |
236 |
237 |
241 | Custom button 242 | 244 |
245 |
246 | Upload it! 247 |
248 |
249 | Cancel 250 |
252 |
258 |
259 | 260 | 261 | 262 | -------------------------------------------------------------------------------- /SlashUploader/SlashUploader.min.css: -------------------------------------------------------------------------------- 1 | /* 2 | * SlashUploader - JS plugin - Version 1.5.9 3 | * http://slashuploader.com/ 4 | * Copyright (c) 2018-present Slash Apps Development, http://slash.co.il/ 5 | * Licensed under the MIT License [https://en.wikipedia.org/wiki/MIT_License] 6 | */ 7 | 8 | .slash_uploader_form{width:0;height:0;margin:0;padding:0;display:none}.slash_uploader .uploader_container{margin:0;padding:0;display:inline;font-family:Arial,Helvetica,sans-serif;font-size:13px}.slash_uploader:not(.rtl){direction:ltr}.slash_uploader .uploader_container .uploader_div{min-height:30px;width:100%;border-collapse:separate}.slash_uploader.loading_bar .uploader_container .uploader_div{height:calc(100% - 25px)}.slash_uploader .uploader_div .uploader_drop_area_wrapper{width:50%;position:relative;float:left;overflow:hidden}.slash_uploader.rtl .uploader_drop_area_wrapper{float:right}.slash_uploader .uploader_drop_area{border:1px solid #09F;color:#0080D6;position:absolute;overflow:hidden;display:block;text-align:center;border-radius:4px;z-index:4;display:table;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.slash_uploader .uploader_drop_area .uploader_text{display:table-cell;vertical-align:middle}.slash_uploader .uploader_drop_area .uploader_text .uploader_text_container{overflow:hidden}.slash_uploader.rtl .uploader_drop_area .uploader_text{direction:rtl}.slash_uploader.uploading .uploader_drop_area .uploader_text .uploader_text_container,.slash_uploader .uploader_drop_area .uploader_cancel span{background:#fff;display:inline;padding:3px;line-height:21px;box-shadow:3px 0 0 white,-3px 0 0 #fff}.slash_uploader .uploader_drop_area .uploader_cancel{position:absolute;bottom:5px;right:5px;z-index:2;display:none}.slash_uploader.rtl .uploader_drop_area .uploader_cancel{right:auto;left:5px;direction:rtl}.slash_uploader .uploader_drop_area .uploader_cancel span{color:red;font-size:12px;line-height:14px;cursor:pointer}.slash_uploader .uploader_drop_area_bottom,.slash_uploader .uploader_drop_area_bottom_bg,.slash_uploader .uploader_drop_area_middle{position:absolute;border-radius:4px;overflow:hidden;vertical-align:middle}.slash_uploader .uploader_drop_area_bottom{border-bottom-right-radius:0;border-top-right-radius:0}.slash_uploader.rtl .uploader_drop_area_bottom{border-bottom-right-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:0;border-top-left-radius:0}.slash_uploader[data-file-progress='99'] .uploader_drop_area_bottom,.slash_uploader[data-file-progress='100'] .uploader_drop_area_bottom{border-bottom-right-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-top-left-radius:4px}.slash_uploader .uploader_drop_area_bottom,.slash_uploader .uploader_drop_area_bottom_bg,.slash_uploader .uploader_drop_area_middle,.slash_uploader .uploader_drop_area{height:100%;width:100%;top:0;bottom:0;left:0;right:0}.slash_uploader .uploader_drop_area_bottom_bg{background:#FFF;z-index:1}.slash_uploader .uploader_drop_area_bottom{background:#E5F5FF;z-index:2}.slash_uploader.rtl .uploader_drop_area_bottom{left:auto;direction:rtl}.slash_uploader .uploader_drop_area_middle{z-index:3}.slash_uploader .uploader_drop_area_bottom img,.slash_uploader .uploader_drop_area_middle img{filter:blur(1px);-webkit-filter:blur(.8px);-moz-filter:blur(.8px);-o-filter:blur(.8px);-ms-filter:blur(.8px);filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='1');position:relative;left:-1px;top:50%;transform:translateY(-50%)}.slash_uploader .uploader_drop_area_bottom img{opacity:.65}.slash_uploader .uploader_drop_area_middle img{opacity:.15}.slash_uploader:not(.hover):not(.dragged_over) .uploader_drop_area{-webkit-transition:background-color 0.3s ease;transition:background-color 0.3s ease}.slash_uploader.hover .uploader_drop_area{background:#E5F5FF;padding:0 0 0 0}.slash_uploader.dragged_over .uploader_drop_area{background:#E5F5FF;border:2px dashed #09F;padding:0 0 0 0}.slash_uploader.dragged_enter .uploader_drop_area{background:#FFF;border:2px dashed #09F;padding:0 0 0 0}.slash_uploader.show_focus_rect.focused .uploader_drop_area_wrapper{outline-width:1px;outline-style:solid;outline-color:Highlight}.slash_uploader .uploader_drop_area .uploader_spinner{top:4px;left:-3px}.slash_uploader.rtl .uploader_drop_area .uploader_spinner{left:3px}.slash_uploader .uploader_drop_area .input_wrapper{width:100%;height:100%;overflow:hidden;position:absolute;left:0;direction:ltr!important}.slash_uploader .uploader_drop_area input,.slash_uploader .uploader_drop_area_custom input{position:absolute;left:0;top:0;font-family:Arial;margin:0;padding:0;cursor:pointer;height:40px;width:200px;font-size:0;opacity:0;filter:alpha(opacity=0);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.slash_uploader .uploader_drop_area_custom{overflow:hidden;width:100%;height:100%;position:absolute;top:0;left:0}.slash_uploader.disabled{cursor:default;opacity:.5;filter:alpha(opacity=50);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50)}.slash_uploader .uploader_progress_container{padding-top:5px;height:20px;float:left;width:100%;overflow:hidden}.slash_uploader .uploader_progress_container>table{width:100%;border-spacing:0;border-collapse:collapse;border:none}.slash_uploader.rtl .uploader_progress_container table{direction:rtl}.slash_uploader .uploader_progress_container .uploader_progress_bar{width:auto}.slash_uploader .uploader_progress_container .uploader_progress_bar>div{width:100%;height:12px;border:1px solid #000;padding:1px 1px 1px 1px}.slash_uploader .uploader_progress_container .uploader_progress_bar>div>div{background:#09F;height:100%;width:100%}.slash_uploader .uploader_progress_bar_padding{width:10px}.slash_uploader .uploader_progress_bar_loading_padding{width:3px}.slash_uploader .uploader_progress_bar_loading{width:20px}.slash_uploader .uploader_progress_bar_text{width:1%;white-space:nowrap;max-width:60%;overflow:hidden}.slash_uploader.rtl .uploader_progress_bar_text{text-align:right}.slash_uploader .uploader_progress_container .uploader_progress_bar div div{width:0%}@-ms-keyframes spin{from{-ms-transform:rotate(0deg)}to{-ms-transform:rotate(360deg)}}@-moz-keyframes spin{from{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(360deg)}}@-webkit-keyframes spin{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(360deg)}}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.slash_uploader .uploader_spinner{position:relative;left:0;top:0;width:14px;height:14px;border-radius:50%;display:inline-block;border:2px solid #09F;border-right:2px solid rgba(0,153,255,.25);border-bottom:2px solid rgba(0,153,255,.25);border-left:2px solid rgba(0,153,255,.25);-webkit-animation:spin 1s ease infinite;-moz-animation:spin 1s ease infinite;animation:spin 1s ease infinite}.slash_uploader .uploader_progress_bar_loading .uploader_spinner{display:block}.slash_uploader .uploader_result_wrapper{padding-right:6px;padding-left:6px;overflow:hidden;vertical-align:bottom;word-break:break-word;width:calc(50% - 12px);float:left;min-height:100%;display:table;text-align:left}.slash_uploader.rtl .uploader_result_wrapper{float:right;text-align:right}.slash_uploader .uploader_result{height:100%;display:table-cell;vertical-align:bottom}.slash_uploader .uploader_result.error{color:red;word-break:break-word}.slash_uploader.rtl .uploader_result.error{text-align:right;direction:rtl}.slash_uploader .uploader_delete_btn div{position:relative;top:2px;border:none;width:16px;height:16px;display:inline-block;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAeUlEQVQ4jdWSUQoDIQxEX4oX2IP1Skrmwj1C+qPgrutSl360D8RJMGEStIjgiKQhmXO2Y87MICJ2x93jjJrfvQUwdx8tfEgpxVK1t1wsCYDUB7e4mntG2wfAY2btSvcMDVb54wZtJz84Qv8rZ/qrDlK9N0mvhbpnE2+HaoSqJnzSpgAAAABJRU5ErkJggg==)}.slash_uploader .uploader_result_file{min-width:40px;word-break:break-all}.slash_uploader .uploader_result_file a{color:#09F}.slash_uploader.rtl .uploader_result_file{direction:rtl}.slash_uploader.disabled .uploader_delete_btn,.slash_uploader.disabled .uploader_delete_btn div,.slash_uploader.disabled .uploader_delete_btn a{cursor:default!important}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){.slash_uploader.disabled .uploader_drop_area_bottom_bg{display:none}}@media \0screen{.slash_uploader .uploader_drop_area input{width:200px!important}.slash_uploader .uploader_drop_area input,.slash_uploader .uploader_drop_area_custom input{border:none;outline:none;outline-style:none}.slash_uploader .uploader_drop_area input,.slash_uploader .uploader_drop_area_custom input{font-size:240px}.slash_uploader .uploader_result_wrapper{height:96%}.slash_uploader.disabled .uploader_drop_area_wrapper,.slash_uploader.disabled .uploader_drop_area,.slash_uploader.disabled .uploader_text{filter:alpha(opacity=50);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50)}.slash_uploader.loading_bar .uploader_container .uploader_div{height:80%}.slash_uploader .uploader_progress_container{padding-top:0}.slash_uploader .uploader_progress_bar_loading,.slash_uploader .uploader_progress_bar_loading_padding{display:none}.slash_uploader .uploader_spinner{display:none}.slash_uploader .uploader_result_wrapper{word-break:normal;width:45%}.slash_uploader .uploader_result.error{word-break:normal}}@media screen and (min-width:0) and (min-resolution:.001dpcm){.slash_uploader .uploader_drop_area input,.slash_uploader .uploader_drop_area_custom input{font-size:240px\9}.slash_uploader .uploader_progress_bar_loading,.slash_uploader .uploader_progress_bar_loading_padding{display:none\9}.slash_uploader .uploader_spinner{display:none\9}.slash_uploader .uploader_result_wrapper{width:45%\9}.slash_uploader .uploader_drop_area,.slash_uploader .uploader_drop_area_bottom_bg{width:99%\9}}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){.slash_uploader .uploader_drop_area input,.slash_uploader .uploader_drop_area_custom input{font-size:240px}.slash_uploader .uploader_drop_area,.slash_uploader .uploader_drop_area_bottom_bg{width:99%}*::-ms-backdrop,.slash_uploader .uploader_drop_area{width:100%}*::-ms-backdrop,.slash_uploader .uploader_drop_area_bottom_bg{width:100%}}@media (max-width:640px){.slash_uploader[data-show-uploaded-files='default'] .uploader_drop_area_wrapper{width:100%!important}.slash_uploader[data-show-uploaded-files='default'] .uploader_result_wrapper{height:auto!important;width:calc(100% - 25px);display:block}.slash_uploader[data-show-uploaded-files='default'] .uploader_result{display:inline}.slash_uploader[data-show-uploaded-files='default'] .uploader_result_file:first-child{padding-top:5px}.slash_uploader[data-show-uploaded-files='default'] .uploader_progress_bar_padding{width:4px}.slash_uploader .uploader_drop_area .uploader_spinner{width:12px;height:12px;top:4px}.uploader_progress_bar_text{font-size:14px}}.slash_uploader[data-show-uploaded-files='below'] .uploader_drop_area_wrapper{width:100%!important}.slash_uploader[data-show-uploaded-files='below'] .uploader_result_wrapper{height:auto!important;width:calc(100% - 25px);display:block}.slash_uploader[data-show-uploaded-files='below'] .uploader_result{display:inline}.slash_uploader[data-show-uploaded-files='below'] .uploader_result_file:first-child{padding-top:5px}.slash_uploader[data-show-uploaded-files='below'] .uploader_progress_bar_padding{width:4px} -------------------------------------------------------------------------------- /demo/image_cropper/image_cropper.js: -------------------------------------------------------------------------------- 1 | 2 | var ImageCropper = { 3 | 4 | rotateSliderTotalWidth: 2200, 5 | 6 | rotateSliderBlankPixelsWidth: 200, 7 | 8 | pagesFadeSpeed: 300, 9 | 10 | isMobile: (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4))), 11 | 12 | addCropperPopupHtmlToDom: function () { 13 | 14 | if (document.getElementById('cropper_popup') == null) { 15 | 16 | var cropPopupHtml = '\ 17 |
\ 18 |
\ 19 | \ 20 | Your browser does not support the HTML5 canvas element.\ 21 | \ 22 |
\ 23 |
Loading...
\ 24 |
\ 25 |
\ 26 |
\ 27 |
\ 28 |
\ 29 |
\ 30 | \ 31 |
\ 32 |
\ 33 |
\ 34 | Enlarge\ 35 | Reduce\ 36 | \ 37 | Flip Horizontal\ 38 | Flip Vertical\ 39 | \ 40 | Save\ 41 | Reset\ 42 | Cancel\ 43 |
\ 44 |
'; 45 | $("body").append(cropPopupHtml); 46 | 47 | setTimeout(function () { 48 | var slideWidth = (ImageCropper.rotateSliderTotalWidth - ImageCropper.rotateSliderBlankPixelsWidth * 2) / 2; 49 | document.getElementById('cropper_slides').style.left = Math.floor((document.getElementById('cropper_rotation_slider').offsetWidth / 2 - ImageCropper.rotateSliderBlankPixelsWidth) - slideWidth) + "px"; 50 | }, 1); 51 | 52 | } 53 | 54 | }, 55 | 56 | startCropImages: function (files, openerUploader, cropSizeRatio, onCompleted) { 57 | 58 | ImageCropper.addCropperPopupHtmlToDom(); 59 | $("#cropper_popup").fadeIn(ImageCropper.pagesFadeSpeed, function () { 60 | ImageCropper.cropCurrentImage(files, 0, openerUploader, cropSizeRatio, function () { 61 | $("#cropper_popup").fadeOut(ImageCropper.pagesFadeSpeed, function () { 62 | onCompleted(); 63 | $("#cropper_popup").remove(); 64 | }); 65 | }); 66 | }); 67 | 68 | }, 69 | 70 | cropCurrentImage: function (selectedFiles, fileIndex, openerUploader, cropSizeRatio, onCompleted) { 71 | 72 | var curFileData = selectedFiles[fileIndex]; 73 | var curFile = selectedFiles[fileIndex].file; 74 | if (curFile.type.match(/^image\//)) { 75 | 76 | document.getElementById('cropper_loading').style.display = "block"; 77 | document.getElementById('cropper_canvas').style.opacity = "0"; 78 | document.getElementById('cropper_canvas').style.height = "150px"; 79 | document.getElementById("cropper_container").style.height = (window.innerHeight - 135) + "px"; 80 | 81 | var initAngle = 0; 82 | if (!isNaN(curFileData.rotation) && curFileData.rotation > 0) { 83 | initAngle = curFileData.rotation; 84 | if (initAngle > 180) { 85 | initAngle -= 360; 86 | } else if (initAngle < -180) { 87 | initAngle += 360; 88 | } 89 | } 90 | 91 | var reader = new FileReader(); 92 | reader.onload = function (evt) { 93 | var img = new Image(); 94 | img.onload = function () { 95 | document.getElementById('cropper_loading').style.display = "none"; 96 | var canvas = document.getElementById('cropper_canvas'); 97 | context = canvas.getContext("2d"); 98 | context.canvas.height = img.height; 99 | context.canvas.width = img.width; 100 | context.clearRect(0, 0, canvas.width, canvas.height); 101 | context.drawImage(img, 0, 0); 102 | cropper = new Cropper(canvas, { 103 | aspectRatio: cropSizeRatio, 104 | //viewMode: ImageCropper.isMobile ? 0 : 2, 105 | viewMode: 0, 106 | dragMode: "move", 107 | ready: function () { 108 | this.cropper.setData({ "rotate": Math.floor(initAngle) }); 109 | }, 110 | crop: function (event) { 111 | var fileObj = selectedFiles[fileIndex]; 112 | fileObj.crop_x = Math.round(event.detail.x); 113 | fileObj.crop_y = Math.round(event.detail.y); 114 | fileObj.crop_width = Math.round(event.detail.width); 115 | fileObj.crop_height = Math.round(event.detail.height); 116 | fileObj.crop_rotate = Math.round(event.detail.rotate); 117 | fileObj.crop_scaleX = event.detail.scaleX; 118 | fileObj.crop_scaleY = event.detail.scaleY; 119 | } 120 | }); 121 | ImageCropper.rotateSlider(cropper, initAngle); 122 | setTimeout(function () { 123 | document.getElementById("cropper_container").style.height = "100%"; 124 | }, 1); 125 | }; 126 | img.src = evt.target.result; 127 | 128 | var cropButton = document.querySelector("#cropper_popup .cropper_btn_crop"); 129 | cropButton.onclick = function () { 130 | cropper.destroy(); 131 | var canvas = document.getElementById('cropper_canvas'); 132 | context = canvas.getContext("2d"); 133 | context.clearRect(0, 0, canvas.width, canvas.height); 134 | if (fileIndex < selectedFiles.length - 1) { 135 | ImageCropper.cropCurrentImage(selectedFiles, fileIndex + 1, openerUploader, cropSizeRatio, onCompleted); 136 | } else { 137 | onCompleted(); 138 | } 139 | }; 140 | 141 | var resizeEnlargeBtn = document.querySelector("#cropper_popup .cropper_btn_resize_enlarge"); 142 | resizeEnlargeBtn.onclick = function () { 143 | cropper.zoom(0.1); 144 | }; 145 | var resizeReduceBtn = document.querySelector("#cropper_popup .cropper_btn_resize_reduce"); 146 | resizeReduceBtn.onclick = function () { 147 | cropper.zoom(-0.1); 148 | }; 149 | var flipHorizontalBtn = document.querySelector("#cropper_popup .cropper_btn_flip_horizontal"); 150 | flipHorizontalBtn.onclick = function () { 151 | cropper.scaleX((cropper.getData().scaleX == -1) ? 1 : -1); 152 | }; 153 | var flipVerticalBtn = document.querySelector("#cropper_popup .cropper_btn_flip_vertical"); 154 | flipVerticalBtn.onclick = function () { 155 | cropper.scaleY((cropper.getData().scaleY == -1) ? 1 : -1); 156 | }; 157 | 158 | var cancelBtn = document.querySelector("#cropper_popup .cropper_btn_cancel"); 159 | cancelBtn.onclick = function () { 160 | $("#cropper_popup").fadeOut(ImageCropper.pagesFadeSpeed, function () { 161 | cropper.destroy(); 162 | openerUploader.cancelUpload(); 163 | $("#cropper_popup").remove(); 164 | }); 165 | }; 166 | 167 | var resetBtn = document.querySelector("#cropper_popup .cropper_btn_reset"); 168 | resetBtn.onclick = function () { 169 | cropper.reset(); 170 | ImageCropper.setRotateSliderAngle(cropper, initAngle); 171 | }; 172 | 173 | }; 174 | reader.readAsDataURL(curFile); 175 | 176 | 177 | } else { 178 | 179 | if (fileIndex < selectedFiles.length - 1) { 180 | ImageCropper.cropCurrentImage(selectedFiles, fileIndex + 1, openerUploader, cropSizeRatio, onCompleted); 181 | } else { 182 | onCompleted(); 183 | } 184 | 185 | } 186 | 187 | }, 188 | 189 | setRotateSliderAngle: function (cropper, angle) { 190 | var slider = document.getElementById('cropper_rotation_slider'); 191 | var items = document.getElementById('cropper_slides'); 192 | var slideWidth = (ImageCropper.rotateSliderTotalWidth - ImageCropper.rotateSliderBlankPixelsWidth * 2) / 2; 193 | items.style.left = Math.floor((angle / -180) * slideWidth + (slider.offsetWidth / 2 - ImageCropper.rotateSliderBlankPixelsWidth) - slideWidth) + "px"; 194 | cropper.setData({ "rotate": Math.floor(angle) }); 195 | }, 196 | 197 | rotateSlider: function (cropper, initAngle) { 198 | 199 | var slider = document.getElementById('cropper_rotation_slider'), 200 | sliderItems = document.getElementById('cropper_slides'); 201 | 202 | 203 | function slide(items) { 204 | 205 | var posX1 = 0, 206 | posX2 = 0; 207 | 208 | ImageCropper.setRotateSliderAngle(cropper, initAngle); 209 | 210 | // Mouse events 211 | items.onmousedown = dragStart; 212 | 213 | // Touch events 214 | /* 215 | items.addEventListener('touchstart', dragStart); 216 | items.addEventListener('touchend', dragEnd); 217 | items.addEventListener('touchmove', dragAction); 218 | */ 219 | items.ontouchstart = dragStart; 220 | items.ontouchend = dragEnd; 221 | items.ontouchmove = dragAction; 222 | 223 | function dragStart(e) { 224 | e = e || window.event; 225 | e.preventDefault(); 226 | posInitial = items.offsetLeft; 227 | items.className = "dragging"; 228 | 229 | if (e.type == 'touchstart') { 230 | posX1 = e.touches[0].clientX; 231 | } else { 232 | posX1 = e.clientX; 233 | document.onmouseup = dragEnd; 234 | document.onmousemove = dragAction; 235 | } 236 | } 237 | 238 | function dragAction(e) { 239 | e = e || window.event; 240 | 241 | if (e.type == 'touchmove') { 242 | posX2 = posX1 - e.touches[0].clientX; 243 | posX1 = e.touches[0].clientX; 244 | } else { 245 | posX2 = posX1 - e.clientX; 246 | posX1 = e.clientX; 247 | } 248 | 249 | var sliderLeftPosition = (items.offsetLeft - posX2); 250 | var slideWidth = (ImageCropper.rotateSliderTotalWidth - ImageCropper.rotateSliderBlankPixelsWidth * 2) / 2; 251 | var degree = (sliderLeftPosition - (slider.offsetWidth / 2 - ImageCropper.rotateSliderBlankPixelsWidth) + slideWidth) / slideWidth * -180; 252 | if (degree >= -180 && degree <= 180) { 253 | items.style.left = (sliderLeftPosition) + "px"; 254 | cropper.setData({ "rotate": Math.round(degree) }); 255 | } 256 | } 257 | 258 | function dragEnd(e) { 259 | items.className = ""; 260 | posFinal = items.offsetLeft; 261 | document.onmouseup = null; 262 | document.onmousemove = null; 263 | } 264 | 265 | } 266 | 267 | slide(sliderItems); 268 | } 269 | 270 | }; -------------------------------------------------------------------------------- /SlashUploader/SlashUploader.src.css: -------------------------------------------------------------------------------- 1 | /* 2 | * SlashUploader - JS plugin - Version 1.5.9 3 | * http://slashuploader.com/ 4 | * Copyright (c) 2018-present Slash Apps Development, http://slash.co.il/ 5 | * Licensed under the MIT License [https://en.wikipedia.org/wiki/MIT_License] 6 | */ 7 | 8 | .slash_uploader_form { 9 | width: 0; height: 0; 10 | margin: 0; padding: 0; display: none; 11 | } 12 | .slash_uploader .uploader_container { 13 | margin: 0; padding: 0; display: inline; 14 | font-family: Arial, Helvetica, sans-serif; font-size: 13px; 15 | } 16 | .slash_uploader:not(.rtl) { 17 | direction: ltr; 18 | } 19 | .slash_uploader .uploader_container .uploader_div { 20 | min-height: 30px; 21 | width: 100%; 22 | /*height: 100%;*/ 23 | border-collapse: separate; 24 | } 25 | .slash_uploader.loading_bar .uploader_container .uploader_div { 26 | height: calc(100% - 25px); 27 | } 28 | .slash_uploader .uploader_div .uploader_drop_area_wrapper { 29 | width: 50%; 30 | /*height: 100%;*/ 31 | position: relative; 32 | float: left; 33 | overflow: hidden; 34 | } 35 | .slash_uploader.rtl .uploader_drop_area_wrapper { 36 | float: right; 37 | } 38 | .slash_uploader .uploader_drop_area { 39 | border: 1px solid #09F; 40 | color: #0080D6; 41 | position: absolute; 42 | overflow: hidden; 43 | display: block; 44 | text-align: center; 45 | border-radius: 4px; 46 | z-index: 4; 47 | display: table; 48 | box-sizing: border-box; 49 | -moz-box-sizing: border-box; 50 | -webkit-box-sizing: border-box; 51 | } 52 | .slash_uploader .uploader_drop_area .uploader_text { 53 | display: table-cell; 54 | vertical-align: middle; 55 | } 56 | .slash_uploader .uploader_drop_area .uploader_text .uploader_text_container { 57 | overflow: hidden; 58 | } 59 | .slash_uploader.rtl .uploader_drop_area .uploader_text { 60 | direction: rtl; 61 | } 62 | .slash_uploader.uploading .uploader_drop_area .uploader_text .uploader_text_container, 63 | .slash_uploader .uploader_drop_area .uploader_cancel span { 64 | background: white; 65 | display: inline; 66 | padding: 3px; 67 | line-height: 21px; 68 | box-shadow: 3px 0 0 white, -3px 0 0 white; 69 | /*box-decoration-break: clone;*/ 70 | } 71 | .slash_uploader .uploader_drop_area .uploader_cancel { 72 | position: absolute; 73 | bottom: 5px; right: 5px; 74 | z-index: 2; 75 | display: none; 76 | } 77 | .slash_uploader.rtl .uploader_drop_area .uploader_cancel { 78 | right: auto; left: 5px; 79 | direction: rtl; 80 | } 81 | .slash_uploader .uploader_drop_area .uploader_cancel span { 82 | color: red; 83 | font-size: 12px; 84 | line-height: 14px; 85 | cursor: pointer; 86 | } 87 | .slash_uploader .uploader_drop_area_bottom, 88 | .slash_uploader .uploader_drop_area_bottom_bg, 89 | .slash_uploader .uploader_drop_area_middle { 90 | position: absolute; 91 | border-radius: 4px; 92 | overflow: hidden; 93 | vertical-align: middle; 94 | } 95 | .slash_uploader .uploader_drop_area_bottom { 96 | border-bottom-right-radius: 0px; 97 | border-top-right-radius: 0px; 98 | } 99 | .slash_uploader.rtl .uploader_drop_area_bottom { 100 | border-bottom-right-radius: 4px; 101 | border-top-right-radius: 4px; 102 | border-bottom-left-radius: 0px; 103 | border-top-left-radius: 0px; 104 | } 105 | .slash_uploader[data-file-progress='99'] .uploader_drop_area_bottom, 106 | .slash_uploader[data-file-progress='100'] .uploader_drop_area_bottom 107 | { 108 | border-bottom-right-radius: 4px; 109 | border-top-right-radius: 4px; 110 | border-bottom-left-radius: 4px; 111 | border-top-left-radius: 4px; 112 | } 113 | 114 | .slash_uploader .uploader_drop_area_bottom, 115 | .slash_uploader .uploader_drop_area_bottom_bg, 116 | .slash_uploader .uploader_drop_area_middle, 117 | .slash_uploader .uploader_drop_area { 118 | height: 100%; 119 | width: 100%; 120 | top: 0; 121 | bottom: 0; 122 | left: 0; 123 | right: 0; 124 | } 125 | .slash_uploader .uploader_drop_area_bottom_bg { 126 | background: #FFF; 127 | z-index: 1; 128 | } 129 | .slash_uploader .uploader_drop_area_bottom { 130 | background: #E5F5FF; 131 | z-index: 2; 132 | } 133 | .slash_uploader.rtl .uploader_drop_area_bottom { 134 | left: auto; 135 | direction: rtl; 136 | } 137 | .slash_uploader .uploader_drop_area_middle { 138 | z-index: 3; 139 | } 140 | .slash_uploader .uploader_drop_area_bottom img, 141 | .slash_uploader .uploader_drop_area_middle img { 142 | filter: blur(1px); 143 | -webkit-filter: blur(0.8px); 144 | -moz-filter: blur(0.8px); 145 | -o-filter: blur(0.8px); 146 | -ms-filter: blur(0.8px); 147 | /*filter: url(#blur);*/ /* Removed - causes problems on Firefox, Chrome, ect. */ 148 | filter:progid: DXImageTransform.Microsoft.Blur(PixelRadius='1'); 149 | position: relative; 150 | left: -1px; 151 | top: 50%; 152 | transform: translateY(-50%); 153 | } 154 | .slash_uploader .uploader_drop_area_bottom img { 155 | opacity: 0.65; 156 | } 157 | .slash_uploader .uploader_drop_area_middle img { 158 | opacity: 0.15; 159 | } 160 | .slash_uploader:not(.hover):not(.dragged_over) .uploader_drop_area { 161 | -webkit-transition: background-color 0.3s ease; 162 | transition: background-color 0.3s ease; 163 | } 164 | .slash_uploader.hover .uploader_drop_area { 165 | background: #E5F5FF; 166 | padding: 0px 0px 0px 0px; 167 | } 168 | .slash_uploader.dragged_over .uploader_drop_area { 169 | background: #E5F5FF; 170 | border: 2px dashed #09F; 171 | padding: 0px 0px 0px 0px; 172 | } 173 | .slash_uploader.dragged_enter .uploader_drop_area { 174 | background: #FFFFFF; 175 | border: 2px dashed #09F; 176 | padding: 0px 0px 0px 0px; 177 | } 178 | .slash_uploader.show_focus_rect.focused .uploader_drop_area_wrapper { 179 | outline-width: 1px; 180 | outline-style: solid; 181 | outline-color: Highlight; 182 | } 183 | .slash_uploader .uploader_drop_area .uploader_spinner { 184 | top: 4px; left: -3px; 185 | } 186 | .slash_uploader.rtl .uploader_drop_area .uploader_spinner { 187 | left: 3px; 188 | } 189 | .slash_uploader .uploader_drop_area .input_wrapper { 190 | width: 100%; height: 100%; 191 | overflow: hidden; 192 | position: absolute; 193 | left: 0; 194 | direction: ltr !important; 195 | } 196 | /* 197 | .slash_uploader .uploader_drop_area input { 198 | position: absolute; right: 0px; top: 0px; 199 | font-family: Arial; 200 | margin: 0; padding: 0; 201 | font-size: 240px; 202 | height: 6000px; 203 | cursor: pointer; 204 | opacity: 0; 205 | filter: alpha(opacity = 0); 206 | direction: ltr !important; 207 | width: auto !important; 208 | } 209 | */ 210 | .slash_uploader .uploader_drop_area input, 211 | .slash_uploader .uploader_drop_area_custom input { 212 | position: absolute; left: 0px; top: 0px; 213 | font-family: Arial; 214 | margin: 0; padding: 0; 215 | cursor: pointer; 216 | /*height: 100px;*/ 217 | height: 40px; 218 | width: 200px; 219 | font-size: 0; 220 | opacity: 0; 221 | filter: alpha(opacity=0); 222 | filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); 223 | -webkit-touch-callout: none; 224 | -webkit-user-select: none; 225 | -khtml-user-select: none; 226 | -moz-user-select: none; 227 | -ms-user-select: none; 228 | user-select: none; 229 | -webkit-tap-highlight-color: transparent; 230 | -webkit-touch-callout: none; 231 | } 232 | 233 | .slash_uploader .uploader_drop_area_custom { 234 | overflow: hidden; 235 | width: 100%; 236 | height: 100%; 237 | position: absolute; 238 | top: 0; 239 | left: 0; 240 | } 241 | 242 | .slash_uploader.disabled { 243 | cursor: default; 244 | opacity: 0.5; 245 | filter: alpha(opacity = 50); 246 | filter: progid:DXImageTransform.Microsoft.Alpha(opacity = 50); 247 | } 248 | 249 | /* 250 | 251 | Progress Bar 252 | 253 | */ 254 | .slash_uploader .uploader_progress_container { 255 | padding-top: 5px; 256 | height: 20px; 257 | float: left; 258 | width: 100%; 259 | overflow: hidden; 260 | } 261 | .slash_uploader .uploader_progress_container>table { 262 | width: 100%; 263 | border-spacing: 0; border-collapse: collapse; border: none; 264 | } 265 | .slash_uploader.rtl .uploader_progress_container table { 266 | direction: rtl; 267 | } 268 | .slash_uploader .uploader_progress_container .uploader_progress_bar { 269 | width: auto; 270 | } 271 | .slash_uploader .uploader_progress_container .uploader_progress_bar>div { 272 | width: 100%; height: 12px; border: 1px solid black; 273 | padding: 1px 1px 1px 1px; 274 | } 275 | .slash_uploader .uploader_progress_container .uploader_progress_bar>div>div { 276 | background: #09F; height: 100%; 277 | width: 100%; 278 | } 279 | .slash_uploader .uploader_progress_bar_padding { 280 | width: 10px; 281 | } 282 | .slash_uploader .uploader_progress_bar_loading_padding { 283 | width: 3px; 284 | } 285 | .slash_uploader .uploader_progress_bar_loading { 286 | width: 20px; 287 | } 288 | .slash_uploader .uploader_progress_bar_text { 289 | width: 1%; 290 | white-space: nowrap; 291 | /*max-width: 250px;*/ 292 | max-width: 60%; 293 | overflow: hidden; 294 | } 295 | .slash_uploader.rtl .uploader_progress_bar_text { 296 | text-align: right; 297 | } 298 | .slash_uploader .uploader_progress_container .uploader_progress_bar div div { 299 | width: 0%; 300 | } 301 | /* 302 | 303 | Spiner animation 304 | 305 | */ 306 | @-ms-keyframes spin { 307 | from { -ms-transform: rotate(0deg); } 308 | to { -ms-transform: rotate(360deg); } 309 | } 310 | @-moz-keyframes spin { 311 | from { -moz-transform: rotate(0deg); } 312 | to { -moz-transform: rotate(360deg); } 313 | } 314 | @-webkit-keyframes spin { 315 | from { -webkit-transform: rotate(0deg); } 316 | to { -webkit-transform: rotate(360deg); } 317 | } 318 | @keyframes spin { 319 | from { 320 | transform:rotate(0deg); 321 | } 322 | to { 323 | transform:rotate(360deg); 324 | } 325 | } 326 | .slash_uploader .uploader_spinner { 327 | position: relative; 328 | left: 0px; 329 | top: 0px; 330 | width: 14px; 331 | height: 14px; 332 | border-radius:50%; 333 | display:inline-block; 334 | border: 2px solid #09F; 335 | border-right: 2px solid rgba(0, 153, 255, 0.25); 336 | border-bottom: 2px solid rgba(0, 153, 255, 0.25); 337 | border-left: 2px solid rgba(0, 153, 255, 0.25); 338 | -webkit-animation: spin 1s ease infinite; 339 | -moz-animation: spin 1s ease infinite; 340 | animation: spin 1s ease infinite; 341 | } 342 | .slash_uploader .uploader_progress_bar_loading .uploader_spinner { 343 | display: block; 344 | } 345 | /* 346 | 347 | Upload results 348 | 349 | */ 350 | .slash_uploader .uploader_result_wrapper { 351 | padding-right: 6px; 352 | padding-left: 6px; 353 | overflow: hidden; vertical-align: bottom; 354 | word-break: break-word; 355 | /*width: calc(50% - 25px);*/ 356 | width: calc(50% - 12px); 357 | float: left; 358 | min-height: 100%; 359 | display: table; 360 | text-align: left; 361 | } 362 | .slash_uploader.rtl .uploader_result_wrapper { 363 | float: right; 364 | text-align: right; 365 | } 366 | .slash_uploader .uploader_result { 367 | height: 100%; 368 | display: table-cell; 369 | vertical-align: bottom; 370 | } 371 | .slash_uploader .uploader_result.error { 372 | color: red; 373 | /*word-break: normal;*/ 374 | word-break: break-word; 375 | } 376 | .slash_uploader.rtl .uploader_result.error { 377 | text-align: right; 378 | direction: rtl; 379 | } 380 | .slash_uploader .uploader_delete_btn div { 381 | position: relative; 382 | top: 2px; 383 | border: none; 384 | width: 16px; height: 16px; 385 | display: inline-block; 386 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAeUlEQVQ4jdWSUQoDIQxEX4oX2IP1Skrmwj1C+qPgrutSl360D8RJMGEStIjgiKQhmXO2Y87MICJ2x93jjJrfvQUwdx8tfEgpxVK1t1wsCYDUB7e4mntG2wfAY2btSvcMDVb54wZtJz84Qv8rZ/qrDlK9N0mvhbpnE2+HaoSqJnzSpgAAAABJRU5ErkJggg==); 387 | } 388 | .slash_uploader .uploader_result_file { 389 | min-width: 40px; 390 | word-break: break-all; 391 | } 392 | .slash_uploader .uploader_result_file a { 393 | color: #09F; 394 | } 395 | .slash_uploader.rtl .uploader_result_file { 396 | direction: rtl; 397 | } 398 | .slash_uploader.disabled .uploader_delete_btn, 399 | .slash_uploader.disabled .uploader_delete_btn div, 400 | .slash_uploader.disabled .uploader_delete_btn a { 401 | cursor: default !important; 402 | } 403 | /* 404 | 405 | IE @media 406 | 407 | */ 408 | @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { /* IE only */ 409 | .slash_uploader.disabled .uploader_drop_area_bottom_bg { 410 | display: none; 411 | } 412 | } 413 | @media \0screen { /* IE8 only */ 414 | .slash_uploader .uploader_drop_area input { 415 | width: 200px !important; 416 | } 417 | .slash_uploader .uploader_drop_area input, 418 | .slash_uploader .uploader_drop_area_custom input { 419 | border: none; 420 | outline: none; 421 | outline-style: none; 422 | } 423 | .slash_uploader .uploader_drop_area input, 424 | .slash_uploader .uploader_drop_area_custom input { 425 | font-size: 240px; 426 | } 427 | .slash_uploader .uploader_result_wrapper { 428 | height: 96%; 429 | } 430 | .slash_uploader.disabled .uploader_drop_area_wrapper, 431 | .slash_uploader.disabled .uploader_drop_area, 432 | .slash_uploader.disabled .uploader_text 433 | { 434 | filter: alpha(opacity = 50); 435 | filter: progid:DXImageTransform.Microsoft.Alpha(opacity = 50); 436 | } 437 | .slash_uploader.loading_bar .uploader_container .uploader_div { 438 | height: 80%; 439 | } 440 | .slash_uploader .uploader_progress_container { 441 | padding-top: 0; 442 | } 443 | .slash_uploader .uploader_progress_bar_loading, 444 | .slash_uploader .uploader_progress_bar_loading_padding { 445 | display: none; 446 | } 447 | .slash_uploader .uploader_spinner { 448 | display: none; 449 | } 450 | .slash_uploader .uploader_result_wrapper { 451 | word-break: normal; 452 | width: 45%; 453 | } 454 | .slash_uploader .uploader_result.error { 455 | word-break: normal; 456 | } 457 | 458 | } 459 | @media screen and (min-width:0) and (min-resolution: .001dpcm) { /* IE9 Only */ 460 | .slash_uploader .uploader_drop_area input, 461 | .slash_uploader .uploader_drop_area_custom input { 462 | font-size: 240px\9; 463 | } 464 | .slash_uploader .uploader_progress_bar_loading, 465 | .slash_uploader .uploader_progress_bar_loading_padding { 466 | display: none\9; 467 | } 468 | .slash_uploader .uploader_spinner { 469 | display: none\9; 470 | } 471 | .slash_uploader .uploader_result_wrapper { 472 | width: 45%\9; 473 | } 474 | .slash_uploader .uploader_drop_area, 475 | .slash_uploader .uploader_drop_area_bottom_bg 476 | { 477 | width: 99%\9; 478 | } 479 | } 480 | @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { /* IE10 + IE11 only */ 481 | .slash_uploader .uploader_drop_area input, 482 | .slash_uploader .uploader_drop_area_custom input { 483 | font-size: 240px; 484 | } 485 | .slash_uploader .uploader_drop_area, 486 | .slash_uploader .uploader_drop_area_bottom_bg 487 | { 488 | width: 99%; 489 | } 490 | *::-ms-backdrop, .slash_uploader .uploader_drop_area { /* IE11 */ 491 | width: 100%; 492 | } 493 | *::-ms-backdrop, .slash_uploader .uploader_drop_area_bottom_bg { /* IE11 */ 494 | width: 100%; 495 | } 496 | } 497 | 498 | @media (max-width: 640px) { 499 | .slash_uploader[data-show-uploaded-files='default'] .uploader_drop_area_wrapper { 500 | width: 100% !important; 501 | } 502 | .slash_uploader[data-show-uploaded-files='default'] .uploader_result_wrapper { 503 | height: auto !important; 504 | width: calc(100% - 25px); 505 | display: block; 506 | } 507 | .slash_uploader[data-show-uploaded-files='default'] .uploader_result { 508 | display: inline; 509 | } 510 | .slash_uploader[data-show-uploaded-files='default'] .uploader_result_file:first-child { 511 | padding-top: 5px; 512 | } 513 | .slash_uploader[data-show-uploaded-files='default'] .uploader_progress_bar_padding { 514 | width: 4px; 515 | } 516 | .slash_uploader .uploader_drop_area .uploader_spinner { 517 | width: 12px; 518 | height: 12px; 519 | top: 4px; 520 | } 521 | .uploader_progress_bar_text { 522 | font-size: 14px; 523 | } 524 | } 525 | /* default / below / beside */ 526 | 527 | .slash_uploader[data-show-uploaded-files='below'] .uploader_drop_area_wrapper { 528 | width: 100% !important; 529 | } 530 | .slash_uploader[data-show-uploaded-files='below'] .uploader_result_wrapper { 531 | height: auto !important; 532 | width: calc(100% - 25px); 533 | display: block; 534 | } 535 | .slash_uploader[data-show-uploaded-files='below'] .uploader_result { 536 | display: inline; 537 | } 538 | .slash_uploader[data-show-uploaded-files='below'] .uploader_result_file:first-child { 539 | padding-top: 5px; 540 | } 541 | .slash_uploader[data-show-uploaded-files='below'] .uploader_progress_bar_padding { 542 | width: 4px; 543 | } 544 | -------------------------------------------------------------------------------- /demo/demo.js: -------------------------------------------------------------------------------- 1 | var uploaderDefault; 2 | var uploaderSingleFile; 3 | var uploaderNoMetadata; 4 | var uploaderDisabled; 5 | var uploaderPreDefinedFiles; 6 | var uploaderProgressBar; 7 | var uploaderRtl; 8 | var uploaderNoDragDrop; 9 | var uploaderNoCancelDelete; 10 | var uploaderNoResults; 11 | var uploaderCrossDomain; 12 | var uploaderWithValidations; 13 | var uploaderNoOverwrite; 14 | var uploaderWithAutoCrop; 15 | var uploaderWithManualCrop; 16 | var uploaderGroupResults; 17 | var uploaderCustomCss; 18 | var uploaderCustomHTML; 19 | 20 | var iframeGateway = "../SlashUploader/iframe_gateway.html"; 21 | 22 | var crossDomainScripts = { 23 | uploadChunk: "//slashuploader.com/src/js/SlashUploader/server/UploadFiles.aspx?upload_method=upload_chunk&file_name={{file_name}}&chunk_index={{chunk_index}}&total_chunks={{total_chunks}}&request_id={{request_id}}&rotation={{rotation}}&file_size={{size}}&file_rotation={{rotation}}&file_duration={{duration}}&file_w={{width}}&file_h={{height}}&file_ext={{extension}}", 24 | uploadStream: "//slashuploader.com/src/js/SlashUploader/server/UploadFiles.aspx?upload_method=upload_stream&rotation={{rotation}}&file_name={{file_name}}&file_size={{size}}&file_rotation={{rotation}}&file_duration={{duration}}&file_w={{width}}&file_h={{height}}&file_ext={{extension}}", 25 | uploadThroughIframe: "//slashuploader.com/src/js/SlashUploader/server/UploadFiles.aspx?upload_method=upload_through_iframe&rotation={{rotation}}&request_id={{request_id}}&iframe_gateway={{iframe_gateway}}&file_size={{size}}&file_rotation={{rotation}}&file_duration={{duration}}&file_w={{width}}&file_h={{height}}&file_ext={{extension}}" 26 | }; 27 | 28 | var sameDomainScripts = { 29 | uploadChunk: "../SlashUploader/server/UploadFiles.aspx?upload_method=upload_chunk&file_name={{file_name}}&chunk_index={{chunk_index}}&total_chunks={{total_chunks}}&request_id={{request_id}}&rotation={{rotation}}&file_size={{size}}&file_rotation={{rotation}}&file_duration={{duration}}&file_w={{width}}&file_h={{height}}&file_ext={{extension}}", 30 | uploadStream: "../SlashUploader/server/UploadFiles.aspx?upload_method=upload_stream&rotation={{rotation}}&file_name={{file_name}}&file_size={{size}}&file_rotation={{rotation}}&file_duration={{duration}}&file_w={{width}}&file_h={{height}}&file_ext={{extension}}", 31 | uploadThroughIframe: "../SlashUploader/server/UploadFiles.aspx?upload_method=upload_through_iframe&rotation={{rotation}}&request_id={{request_id}}&iframe_gateway={{iframe_gateway}}&file_size={{size}}&file_rotation={{rotation}}&file_duration={{duration}}&file_w={{width}}&file_h={{height}}&file_ext={{extension}}" 32 | }; 33 | 34 | 35 | 36 | 37 | function init() { 38 | setTimeout(function () { 39 | buildUploaders(); 40 | }, 10); 41 | } 42 | 43 | if (typeof console == "undefined") console = { // Prevent old browsers error 44 | log: function () { }, 45 | debug: function () { }, 46 | error: function () { }, 47 | warn: function () { } 48 | }; 49 | 50 | function buildUploaders() { 51 | 52 | var onFilesSelected = function (files) { 53 | console.log("onFilesSelected", files); 54 | var str = "Files selected:
"; 55 | for (var i = 0; i < files.length; i++) { 56 | str += files[i].name + "; " + files[i].width + "x" + files[i].height + "
"; 57 | } 58 | var responseElement = this.elements.containerElement.parentNode.parentNode.querySelector(".uploader_status"); 59 | responseElement.innerHTML = str; 60 | }; 61 | 62 | var onFilesUploaded = function (files) { 63 | console.log("onFilesUploaded", files); 64 | var str = "Files uploaded:
"; 65 | for (var i = 0; i < files.length; i++) { 66 | str += files[i].file_name + "
"; 67 | } 68 | var responseElement = this.elements.containerElement.parentNode.parentNode.querySelector(".uploader_status"); 69 | responseElement.innerHTML = str; 70 | }; 71 | 72 | var onFileDeleted = function (deletedFile, files) { 73 | console.log("onFileDeleted", deletedFile, files); 74 | var str = "deleted: "; 75 | str += deletedFile.file_name + "
"; 76 | str += "Files remaining:
"; 77 | for (var i = 0; i < files.length; i++) { 78 | str += files[i].file_name + "
"; 79 | } 80 | var responseElement = this.elements.containerElement.parentNode.parentNode.querySelector(".uploader_status"); 81 | responseElement.innerHTML = str; 82 | } 83 | 84 | var onFilesProgress = function (curUploadingFileProgress, curUploadingFileIndex, totalFilesToUpload) { 85 | var str = Math.floor(curUploadingFileProgress * 100) + "% (" + curUploadingFileIndex + "/" + totalFilesToUpload + ")"; 86 | console.log("onFilesProgress", str); 87 | var responseElement = this.elements.containerElement.parentNode.parentNode.querySelector(".uploader_status"); 88 | responseElement.innerHTML = str; 89 | }; 90 | 91 | var onCanceled = function () { 92 | var str = "Canceled"; 93 | var responseElement = this.elements.containerElement.parentNode.parentNode.querySelector(".uploader_status"); 94 | responseElement.innerHTML = str; 95 | }; 96 | 97 | var onError = function (errors) { 98 | console.log("onError", errors); 99 | var str = "Error with files:
"; 100 | for (var i = 0; i < errors.length; i++) { 101 | if (errors[i].file != null) { 102 | str += errors[i].file.name + "
"; 103 | } 104 | } 105 | var responseElement = this.elements.containerElement.parentNode.parentNode.querySelector(".uploader_status"); 106 | responseElement.innerHTML = str; 107 | }; 108 | 109 | 110 | uploaderDefault = new SlashUploader(document.getElementById("uploader_default"), { 111 | iframeGateway: iframeGateway, 112 | serverScripts: sameDomainScripts 113 | }); 114 | 115 | uploaderSingleFile = new SlashUploader(document.getElementById("uploader_single_file"), { 116 | onFilesSelected: onFilesSelected, 117 | onFilesUploaded: onFilesUploaded, 118 | onFilesProgress: onFilesProgress, 119 | onFileDeleted: onFileDeleted, 120 | onCanceled: onCanceled, 121 | onError: onError, 122 | showFocusRect: true, 123 | iframeGateway: iframeGateway, 124 | serverScripts: sameDomainScripts 125 | }); 126 | uploaderSingleFile.dropFilesText = "Drop file here"; 127 | uploaderSingleFile.browseText = "Drop file here or click to upload"; 128 | uploaderSingleFile.maxFiles = 1; 129 | 130 | 131 | uploaderNoMetadata = new SlashUploader(document.getElementById("uploader_no_metadata"), { 132 | onFilesSelected: onFilesSelected, 133 | onFilesUploaded: onFilesUploaded, 134 | onFilesProgress: onFilesProgress, 135 | onFileDeleted: onFileDeleted, 136 | onCanceled: onCanceled, 137 | onError: onError, 138 | iframeGateway: iframeGateway, 139 | serverScripts: sameDomainScripts 140 | }); 141 | uploaderNoMetadata.doGetFileMetadata = false; 142 | 143 | uploaderDisabled = new SlashUploader(document.getElementById("uploader_disabled"), { 144 | iframeGateway: iframeGateway, 145 | serverScripts: sameDomainScripts 146 | }); 147 | uploaderDisabled.uploadedFiles = [ 148 | { file_name: "2015-08-13(2).jpg", file_path: "//mydomain.com/uploads/2015-08-13(2).jpg" }, 149 | { file_name: "test.png", file_path: "//mydomain.com/uploads/test.png" } 150 | ]; 151 | uploaderDisabled.disabled = true; 152 | uploaderDisabled.onFilesUploaded = function (files) { 153 | this.disabled = true; 154 | }; 155 | 156 | uploaderPreDefinedFiles = new SlashUploader(document.getElementById("uploader_pre_defined_files"), { 157 | onFilesSelected: onFilesSelected, 158 | onFilesUploaded: onFilesUploaded, 159 | onFilesProgress: onFilesProgress, 160 | onFileDeleted: onFileDeleted, 161 | onCanceled: onCanceled, 162 | onError: onError, 163 | iframeGateway: iframeGateway, 164 | serverScripts: sameDomainScripts 165 | }); 166 | uploaderPreDefinedFiles.uploadedFiles = [ 167 | { file_name: "2015-08-13(2).jpg", file_path: "//mydomain.com/uploads/2015-08-13(2).jpg" }, 168 | { file_name: "test.png", file_path: "//mydomain.com/uploads/test.png" } 169 | ]; 170 | 171 | 172 | uploaderProgressBar = new SlashUploader(document.getElementById("uploader_progress_bar"), { 173 | onFilesSelected: onFilesSelected, 174 | onFilesUploaded: onFilesUploaded, 175 | onFilesProgress: onFilesProgress, 176 | onFileDeleted: onFileDeleted, 177 | onCanceled: onCanceled, 178 | onError: onError, 179 | iframeGateway: iframeGateway, 180 | serverScripts: sameDomainScripts 181 | }); 182 | uploaderProgressBar.progressAnimationType = "inline|bar"; 183 | 184 | 185 | uploaderRtl = new SlashUploader(document.getElementById("uploader_rtl"), { 186 | onFilesSelected: onFilesSelected, 187 | onFilesUploaded: onFilesUploaded, 188 | onFilesProgress: onFilesProgress, 189 | onFileDeleted: onFileDeleted, 190 | onCanceled: onCanceled, 191 | onError: onError, 192 | iframeGateway: iframeGateway, 193 | serverScripts: sameDomainScripts 194 | }); 195 | uploaderRtl.progressAnimationType = "inline|bar"; 196 | uploaderRtl.rtl = true; 197 | uploaderRtl.maxFileChars = 10; 198 | uploaderRtl.browseText = "הנח קבצים כאן או לחץ לבחירת קבצים"; 199 | uploaderRtl.browseTextDropDisabled = "לחץ לבחירת קובץ"; 200 | uploaderRtl.dropFilesText = "הנח קבצים כאן"; 201 | uploaderRtl.uploadingFileText = "מעלה את \"{{current_file_name}}\"..."; 202 | uploaderRtl.uploadingFileTextProgressBar = "מעלה את \"{{current_file_name}}\"..."; 203 | uploaderRtl.uploadingFilesText = "מעלה {{total_files}} קבצים..."; 204 | uploaderRtl.uploadingFilesTextProgressBar = "מעלה {{total_files}} קבצים..."; 205 | uploaderRtl.uploadingFileByFileText = "מעלה את הקובץ \"{{current_file_name}}\" (קובץ {{current_file_index}} מתוך {{total_files}})"; 206 | uploaderRtl.cancelText = "ביטול"; 207 | uploaderRtl.uploadedFileTemplate = function (fileData) { 208 | if (fileData.file_name.toLowerCase().indexOf(".jpg") != -1 || fileData.file_name.toLowerCase().indexOf(".png") != -1) { 209 | return "" 210 | } else { 211 | return "" + fileData.file_name + ""; 212 | } 213 | } 214 | uploaderRtl.errors = { 215 | invalidFileExtension: "סוג הקובץ לא נתמך", 216 | invalidFileSize: "הקובץ כבד מדי", 217 | parseFailed: "פירסוס מידע נכשל", 218 | unspecifiedError: "תקלה לא מזוהת", 219 | uploadFailed: "העלאה נכשלה" 220 | }; 221 | 222 | uploaderNoDragDrop = new SlashUploader(document.getElementById("uploader_no_drag_drop"), { 223 | onFilesSelected: onFilesSelected, 224 | onFilesUploaded: onFilesUploaded, 225 | onFilesProgress: onFilesProgress, 226 | onFileDeleted: onFileDeleted, 227 | onCanceled: onCanceled, 228 | onError: onError, 229 | iframeGateway: iframeGateway, 230 | serverScripts: sameDomainScripts 231 | }); 232 | uploaderNoDragDrop.enableDropFiles = false; 233 | 234 | 235 | 236 | uploaderNoCancelDelete = new SlashUploader(document.getElementById("uploader_no_cancel_delete"), { 237 | onFilesSelected: onFilesSelected, 238 | onFilesUploaded: onFilesUploaded, 239 | onFilesProgress: onFilesProgress, 240 | onFileDeleted: onFileDeleted, 241 | onCanceled: onCanceled, 242 | onError: onError, 243 | iframeGateway: iframeGateway, 244 | serverScripts: sameDomainScripts 245 | }); 246 | uploaderNoCancelDelete.enableCancelButton = false; 247 | uploaderNoCancelDelete.enableDeleteButton = false; 248 | 249 | 250 | uploaderNoResults = new SlashUploader(document.getElementById("uploader_no_results"), { 251 | onFilesSelected: onFilesSelected, 252 | onFilesUploaded: onFilesUploaded, 253 | onFilesProgress: onFilesProgress, 254 | onFileDeleted: onFileDeleted, 255 | onCanceled: onCanceled, 256 | onError: onError, 257 | iframeGateway: iframeGateway, 258 | serverScripts: sameDomainScripts 259 | }); 260 | uploaderNoResults.uploadedFilesPosition = "none"; 261 | 262 | 263 | uploaderCrossDomain = new SlashUploader(document.getElementById("uploader_field_cross_domain"), { 264 | onFilesSelected: onFilesSelected, 265 | onFilesUploaded: onFilesUploaded, 266 | onFilesProgress: onFilesProgress, 267 | onFileDeleted: onFileDeleted, 268 | onCanceled: onCanceled, 269 | onError: onError, 270 | iframeGateway: iframeGateway, 271 | serverScripts: sameDomainScripts 272 | }); 273 | uploaderCrossDomain.serverScripts = crossDomainScripts; 274 | uploaderCrossDomain.progressAnimationType = "inline|bar"; 275 | 276 | 277 | 278 | 279 | uploaderWithValidations = new SlashUploader(document.getElementById("uploader_field_validations"), { 280 | onFilesSelected: onFilesSelected, 281 | onFilesUploaded: onFilesUploaded, 282 | onFilesProgress: onFilesProgress, 283 | onFileDeleted: onFileDeleted, 284 | onCanceled: onCanceled, 285 | onError: onError, 286 | showFocusRect: true, 287 | iframeGateway: iframeGateway, 288 | serverScripts: sameDomainScripts 289 | }); 290 | uploaderWithValidations.allowedFilesExtensions = ["mp4", "mov", "avi", "ogv", "wmv", "flv", "mkv", "mpg", "webm"]; 291 | uploaderWithValidations.allowedMaxFileSize = 5000; 292 | uploaderWithValidations.customValidation = function (file) { 293 | if (file.duration == null) { 294 | console.log("Couldn't read metadata for '" + file.name + "', so duration validation isn't possible"); 295 | } else if (file.duration < 10) { 296 | return { error: 'invalid_duration', error_text: "\"{{file_name}}\" duration is less then 10 seconds." }; 297 | } 298 | }; 299 | uploaderWithValidations.errors = { 300 | invalidFileExtension: "File \"{{file_name}}\" is not a supportted video format.", 301 | invalidFileSize: "File \"{{file_name}}\" exceeds 5MB." 302 | }; 303 | uploaderWithValidations.acceptOnlyFilesTypes = "video/*"; 304 | uploaderWithValidations.maxFileChars = 18; 305 | uploaderWithValidations.resetFilesOnEachUpload = false; 306 | 307 | 308 | uploaderNoOverwrite = new SlashUploader(document.getElementById("uploader_no_overwrite"), { 309 | onFilesSelected: onFilesSelected, 310 | onFilesUploaded: onFilesUploaded, 311 | onFilesProgress: onFilesProgress, 312 | onFileDeleted: onFileDeleted, 313 | onCanceled: onCanceled, 314 | onError: onError, 315 | iframeGateway: iframeGateway, 316 | serverScripts: sameDomainScripts 317 | }); 318 | uploaderNoOverwrite.resetFilesOnEachUpload = false; 319 | uploaderNoOverwrite.progressAnimationType = "inline|bar"; 320 | uploaderNoOverwrite.maxFiles = 6; 321 | 322 | 323 | var cropWidth = 400; 324 | var cropHeight = 300; 325 | uploaderWithAutoCrop = new SlashUploader(document.getElementById("uploader_with_auto_crop"), { 326 | onFilesSelected: onFilesSelected, 327 | onFilesUploaded: onFilesUploaded, 328 | onFilesProgress: onFilesProgress, 329 | onFileDeleted: onFileDeleted, 330 | onCanceled: onCanceled, 331 | onError: onError, 332 | compressImageWidth: cropWidth, 333 | compressImageHeight: cropHeight, 334 | iframeGateway: iframeGateway, 335 | serverScripts: sameDomainScripts 336 | }); 337 | var autoCropFields = "&resize_type=ProportionalCropOutsideBottomRight&resize_output_width=" + cropWidth + "&resize_output_height=" + cropHeight; 338 | uploaderWithAutoCrop.serverScripts.uploadChunk = uploaderWithAutoCrop.serverScripts.uploadChunk + autoCropFields; 339 | uploaderWithAutoCrop.serverScripts.uploadStream = uploaderWithAutoCrop.serverScripts.uploadStream + autoCropFields; 340 | uploaderWithAutoCrop.serverScripts.uploadThroughIframe = uploaderWithAutoCrop.serverScripts.uploadThroughIframe + autoCropFields; 341 | 342 | 343 | if (navigator.appVersion.indexOf("MSIE 8") == -1 344 | && navigator.appVersion.indexOf("MSIE 9") == -1) { 345 | 346 | uploaderWithManualCrop = new SlashUploader(document.getElementById("uploader_with_manual_crop"), { 347 | onFilesUploaded: onFilesUploaded, 348 | onFilesProgress: onFilesProgress, 349 | onFileDeleted: onFileDeleted, 350 | onCanceled: onCanceled, 351 | onError: onError, 352 | compressImageWidth: cropWidth * 3, 353 | compressImageHeight: cropHeight * 3, 354 | onFilesSelected: function (files, continueUpload) { 355 | ImageCropper.startCropImages(files, uploaderWithManualCrop, cropWidth / cropHeight, continueUpload); 356 | }, 357 | iframeGateway: iframeGateway, 358 | serverScripts: sameDomainScripts 359 | }); 360 | var manualCropFields = "&resize_type=Manual&resize_output_width=" + cropWidth + "&resize_output_height=" + cropHeight + "&crop_x={{crop_x}}&crop_y={{crop_y}}&crop_width={{crop_width}}&crop_height={{crop_height}}&crop_rotate={{crop_rotate}}&crop_scaleX={{crop_scaleX}}&crop_scaleY={{crop_scaleY}}"; 361 | uploaderWithManualCrop.serverScripts.uploadChunk = uploaderWithManualCrop.serverScripts.uploadChunk + manualCropFields; 362 | uploaderWithManualCrop.serverScripts.uploadStream = uploaderWithManualCrop.serverScripts.uploadStream + manualCropFields; 363 | uploaderWithManualCrop.serverScripts.uploadThroughIframe = uploaderWithManualCrop.serverScripts.uploadThroughIframe + manualCropFields; 364 | 365 | } 366 | 367 | uploaderGroupResults = new SlashUploader(document.getElementById("uploader_group"), { 368 | onFilesSelected: onFilesSelected, 369 | onFilesUploaded: onFilesUploaded, 370 | onFilesProgress: onFilesProgress, 371 | onFileDeleted: onFileDeleted, 372 | onCanceled: onCanceled, 373 | onError: onError, 374 | iframeGateway: iframeGateway, 375 | serverScripts: sameDomainScripts 376 | }); 377 | uploaderGroupResults.groupUploadedFilesResult = true; 378 | uploaderGroupResults.uploadedFileTemplate = function (files) { 379 | if (files.length == 1) { 380 | return "Uploaded one file"; 381 | } else { 382 | return "Uploaded " + files.length + " files"; 383 | } 384 | }; 385 | 386 | uploaderCustomCss = new SlashUploader(document.getElementById("uploader_custom_css"), { 387 | onFilesSelected: onFilesSelected, 388 | onFilesUploaded: onFilesUploaded, 389 | onFilesProgress: onFilesProgress, 390 | onFileDeleted: onFileDeleted, 391 | onCanceled: onCanceled, 392 | onError: onError, 393 | height: 150, 394 | iframeGateway: iframeGateway, 395 | serverScripts: sameDomainScripts 396 | }); 397 | uploaderCustomCss.progressAnimationType = "inline|bar"; 398 | 399 | 400 | 401 | uploaderCustomHTML = new SlashUploader(document.getElementById("uploader_field_custom_button"), { 402 | customHTML: true, 403 | onFilesSelected: onFilesSelected, 404 | onFilesUploaded: onFilesUploaded, 405 | onFilesProgress: onFilesProgress, 406 | onFileDeleted: onFileDeleted, 407 | onCanceled: onCanceled, 408 | onError: onError, 409 | iframeGateway: iframeGateway, 410 | serverScripts: sameDomainScripts 411 | }); 412 | 413 | 414 | } -------------------------------------------------------------------------------- /demo/image_cropper/cropperjs-1.5.6/dist/cropper.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Cropper.js v1.5.6 3 | * https://fengyuanchen.github.io/cropperjs 4 | * 5 | * Copyright 2015-present Chen Fengyuan 6 | * Released under the MIT license 7 | * 8 | * Date: 2019-10-04T04:33:48.372Z 9 | */ 10 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Cropper=e()}(this,function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var i=0;it.width?3===i?h=t.height*r:s=t.width/r:3===i?s=t.width/r:h=t.height*r;var c={aspectRatio:r,naturalWidth:n,naturalHeight:o,width:h,height:s};c.left=(t.width-h)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=ht({},e),this.initialCanvasData=ht({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=i.viewMode,h=n.aspectRatio,s=this.cropped&&o;if(t){var c=Number(i.minCanvasWidth)||0,l=Number(i.minCanvasHeight)||0;1=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,u),n.maxTop=Math.max(0,u))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var n=function(t){var e=t.width,i=t.height,a=t.degree;if(90===(a=Math.abs(a)%180))return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),r=Math.cos(n),h=e*r+i*o,s=e*o+i*r;return 90i.maxWidth||i.widthi.maxHeight||i.heighte.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=ht({},n)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=this.limited,h=i.aspectRatio;if(t){var s=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,l=r?Math.min(a.width,n.width,n.width+n.left,a.width-n.left):a.width,d=r?Math.min(a.height,n.height,n.height+n.top,a.height-n.top):a.height;s=Math.min(s,a.width),c=Math.min(c,a.height),h&&(s&&c?si.maxWidth||i.widthi.maxHeight||i.height=e.width&&i.height>=e.height?k:D),dt(this.cropBox,ht({width:i.width,height:i.height},Et({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ct(this.element,b,this.getData())}},Xt={initPreview:function(){var t=this.element,i=this.crossOrigin,e=this.options.preview,a=i?this.crossOriginUrl:this.url,n=t.alt||"The image to preview",o=document.createElement("img");if(i&&(o.crossOrigin=i),o.src=a,o.alt=n,this.viewBox.appendChild(o),this.viewBoxImage=o,e){var r=e;"string"==typeof e?r=t.ownerDocument.querySelectorAll(e):e.querySelector&&(r=[e]),rt(this.previews=r,function(t){var e=document.createElement("img");wt(t,g,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),i&&(e.crossOrigin=i),e.src=a,e.alt=n,e.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(e)})}},resetPreview:function(){rt(this.previews,function(t){var e=vt(t,g);dt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(e,i){if(tt(e[i]))try{delete e[i]}catch(t){e[i]=void 0}else if(e.dataset)try{delete e.dataset[i]}catch(t){e.dataset[i]=void 0}else e.removeAttribute("data-".concat(ft(i)))}(t,g)})},preview:function(){var h=this.imageData,t=this.canvasData,e=this.cropBoxData,s=e.width,c=e.height,l=h.width,d=h.height,p=e.left-t.left-h.left,u=e.top-t.top-h.top;this.cropped&&!this.disabled&&(dt(this.viewBoxImage,ht({width:l,height:d},Et(ht({translateX:-p,translateY:-u},h)))),rt(this.previews,function(t){var e=vt(t,g),i=e.width,a=e.height,n=i,o=a,r=1;s&&(o=c*(r=i/s)),c&&av&&(M.x=v-u);break;case E:c+M.xw&&(M.y=w-m)}}var y=r[Object.keys(r)[0]],M={x:y.endX-y.startX,y:y.endY-y.startY};switch(h){case D:c+=M.x,l+=M.y;break;case T:if(0<=M.x&&(v<=u||s&&(l<=f||w<=m))){b=!1;break}x(T),(d+=M.x)<0&&(h=E,c-=d=-d),s&&(p=d/s,l+=(o.height-p)/2);break;case N:if(M.y<=0&&(l<=f||s&&(c<=g||v<=u))){b=!1;break}x(N),p-=M.y,l+=M.y,p<0&&(h=W,l-=p=-p),s&&(d=p*s,c+=(o.width-d)/2);break;case E:if(M.x<=0&&(c<=g||s&&(l<=f||w<=m))){b=!1;break}x(E),d-=M.x,c+=M.x,d<0&&(h=T,c-=d=-d),s&&(p=d/s,l+=(o.height-p)/2);break;case W:if(0<=M.y&&(w<=m||s&&(c<=g||v<=u))){b=!1;break}x(W),(p+=M.y)<0&&(h=N,l-=p=-p),s&&(d=p*s,c+=(o.width-d)/2);break;case H:if(s){if(M.y<=0&&(l<=f||v<=u)){b=!1;break}x(N),p-=M.y,l+=M.y,d=p*s}else x(N),x(T),0<=M.x?u or element.");this.element=t,this.options=ht({},G,it(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return function(t,e,i){e&&a(t.prototype,e),i&&a(t,i)}(i,[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[l]){if(e[l]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",!(this.originalUrl=t))return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(Q.test(t))K.test(t)?this.read(function(t){var e=t.replace(Lt,""),i=atob(e),a=new ArrayBuffer(i.length),n=new Uint8Array(a);return rt(n,function(t,e){n[e]=i.charCodeAt(e)}),a}(t)):this.clone();else{var n=new XMLHttpRequest,o=this.clone.bind(this);this.reloading=!0,(this.xhr=n).onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){n.getResponseHeader("content-type")!==q&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&Ot(t)&&i.crossOrigin&&(t=Tt(t)),n.open("GET",t),n.responseType="arraybuffer",n.withCredentials="use-credentials"===i.crossOrigin,n.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=zt(t),n=0,o=1,r=1;if(1
';var o=n.querySelector(".".concat(l,"-container")),r=o.querySelector(".".concat(l,"-canvas")),h=o.querySelector(".".concat(l,"-drag-box")),s=o.querySelector(".".concat(l,"-crop-box")),c=s.querySelector(".".concat(l,"-face"));this.container=a,this.cropper=o,this.canvas=r,this.dragBox=h,this.cropBox=s,this.viewBox=o.querySelector(".".concat(l,"-view-box")),this.face=c,r.appendChild(i),pt(t,X),a.insertBefore(o,t.nextSibling),this.isImg||ut(i,d),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,pt(s,X),e.guides||pt(s.getElementsByClassName("".concat(l,"-dashed")),X),e.center||pt(s.getElementsByClassName("".concat(l,"-center")),X),e.background&&pt(o,"".concat(l,"-bg")),e.highlight||pt(c,p),e.cropBoxMovable&&(pt(c,u),wt(c,m,D)),e.cropBoxResizable||(pt(s.getElementsByClassName("".concat(l,"-line")),X),pt(s.getElementsByClassName("".concat(l,"-point")),X)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),at(e.ready)&&Mt(t,I,e.ready,{once:!0}),Ct(t,I)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),ut(this.element,X))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=Pt,i}},{key:"setDefaults",value:function(t){ht(G,it(t)&&t)}}]),i}();return ht(It.prototype,Yt,Xt,Rt,St,At,jt),It}); -------------------------------------------------------------------------------- /demo/image_cropper/cropperjs-1.5.6/README.md: -------------------------------------------------------------------------------- 1 | # Cropper.js 2 | 3 | [![Build Status](https://img.shields.io/travis/fengyuanchen/cropperjs.svg)](https://travis-ci.org/fengyuanchen/cropperjs) [![Downloads](https://img.shields.io/npm/dm/cropperjs.svg)](https://www.npmjs.com/package/cropperjs) [![Version](https://img.shields.io/npm/v/cropperjs.svg)](https://www.npmjs.com/package/cropperjs) 4 | 5 | > JavaScript image cropper. 6 | 7 | - [Website](https://fengyuanchen.github.io/cropperjs) 8 | - [Photo Editor](https://fengyuanchen.github.io/photo-editor) - An advanced example of Cropper.js. 9 | - [jquery-cropper](https://github.com/fengyuanchen/jquery-cropper) - A jQuery plugin wrapper for Cropper.js. 10 | 11 | ## Table of contents 12 | 13 | - [Features](#features) 14 | - [Main](#main) 15 | - [Getting started](#getting-started) 16 | - [Options](#options) 17 | - [Methods](#methods) 18 | - [Events](#events) 19 | - [No conflict](#no-conflict) 20 | - [Browser support](#browser-support) 21 | - [Contributing](#contributing) 22 | - [Versioning](#versioning) 23 | - [License](#license) 24 | 25 | ## Features 26 | 27 | - Supports 39 [options](#options) 28 | - Supports 27 [methods](#methods) 29 | - Supports 6 [events](#events) 30 | - Supports touch (mobile) 31 | - Supports zooming 32 | - Supports rotating 33 | - Supports scaling (flipping) 34 | - Supports multiple croppers 35 | - Supports to crop on a canvas 36 | - Supports to crop an image in the browser-side by canvas 37 | - Supports to translate Exif Orientation information 38 | - Cross-browser support 39 | 40 | ## Main 41 | 42 | ```text 43 | dist/ 44 | ├── cropper.css 45 | ├── cropper.min.css (compressed) 46 | ├── cropper.js (UMD) 47 | ├── cropper.min.js (UMD, compressed) 48 | ├── cropper.common.js (CommonJS, default) 49 | └── cropper.esm.js (ES Module) 50 | ``` 51 | 52 | ## Getting started 53 | 54 | ### Installation 55 | 56 | ```shell 57 | npm install cropperjs 58 | ``` 59 | 60 | In browser: 61 | 62 | ```html 63 | 64 | 65 | ``` 66 | 67 | The [cdnjs](https://github.com/cdnjs/cdnjs) provides CDN support for Cropper.js's CSS and JavaScript. You can find the links [here](https://cdnjs.com/libraries/cropperjs). 68 | 69 | ### Usage 70 | 71 | #### Syntax 72 | 73 | ```js 74 | new Cropper(element[, options]) 75 | ``` 76 | 77 | - **element** 78 | - Type: `HTMLImageElement` or `HTMLCanvasElement` 79 | - The target image or canvas element for cropping. 80 | 81 | - **options** (optional) 82 | - Type: `Object` 83 | - The options for cropping. Check out the available [options](#options). 84 | 85 | #### Example 86 | 87 | ```html 88 | 89 |
90 | 91 |
92 | ``` 93 | 94 | ```css 95 | /* Limit image width to avoid overflow the container */ 96 | img { 97 | max-width: 100%; /* This rule is very important, please do not ignore this! */ 98 | } 99 | ``` 100 | 101 | ```js 102 | // import 'cropperjs/dist/cropper.css'; 103 | import Cropper from 'cropperjs'; 104 | 105 | const image = document.getElementById('image'); 106 | const cropper = new Cropper(image, { 107 | aspectRatio: 16 / 9, 108 | crop(event) { 109 | console.log(event.detail.x); 110 | console.log(event.detail.y); 111 | console.log(event.detail.width); 112 | console.log(event.detail.height); 113 | console.log(event.detail.rotate); 114 | console.log(event.detail.scaleX); 115 | console.log(event.detail.scaleY); 116 | }, 117 | }); 118 | ``` 119 | 120 | #### FAQ 121 | 122 | How to crop a new area after zoom in or zoom out? 123 | 124 | > Just double click your mouse to enter crop mode. 125 | 126 | How to move the image after cropping an area? 127 | 128 | > Just double click your mouse to enter move mode. 129 | 130 | How to fix aspect ratio in free ratio mode? 131 | 132 | > Just hold the `shift` key when you resize the crop box. 133 | 134 | How to crop a square area in free ratio mode? 135 | 136 | > Just hold the `shift` key when you crop on the image. 137 | 138 | #### Notes 139 | 140 | - The size of the cropper inherits from the size of the image's parent element (wrapper), so be sure to wrap the image with a **visible block element**. 141 | > If you are using cropper in a modal, you should initialize the cropper after the modal is shown completely. Otherwise, you will not get the correct cropper. 142 | 143 | - The outputted cropped data is based on the original image size, so you can use them to crop the image directly. 144 | 145 | - If you try to start cropper on a cross-origin image, please make sure that your browser supports HTML5 [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes), and your image server supports the `Access-Control-Allow-Origin` option (see the [HTTP access control (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)). 146 | 147 | #### Known issues 148 | 149 | - [Known iOS resource limits](https://developer.apple.com/library/mac/documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html): As iOS devices limit memory, the browser may crash when you are cropping a large image (iPhone camera resolution). To avoid this, you may resize the image first (preferably below 1024 pixels) before starting a cropper. 150 | 151 | - Known image size increase: When exporting the cropped image on browser-side with the `HTMLCanvasElement.toDataURL` method, the size of the exported image may be greater than the original image's. This is because the type of the exported image is not the same as the original image's. So just pass the type the original image's as the first parameter to `toDataURL` to fix this. For example, if the original type is JPEG, then use `cropper.getCroppedCanvas().toDataURL('image/jpeg')` to export image. 152 | 153 | [⬆ back to top](#table-of-contents) 154 | 155 | ## Options 156 | 157 | You may set cropper options with `new Cropper(image, options)`. 158 | If you want to change the global default options, You may use `Cropper.setDefaults(options)`. 159 | 160 | ### viewMode 161 | 162 | - Type: `Number` 163 | - Default: `0` 164 | - Options: 165 | - `0`: no restrictions 166 | - `1`: restrict the crop box to not exceed the size of the canvas. 167 | - `2`: restrict the minimum canvas size to fit within the container. If the proportions of the canvas and the container differ, the minimum canvas will be surrounded by extra space in one of the dimensions. 168 | - `3`: restrict the minimum canvas size to fill fit the container. If the proportions of the canvas and the container are different, the container will not be able to fit the whole canvas in one of the dimensions. 169 | 170 | Define the view mode of the cropper. If you set `viewMode` to `0`, the crop box can extend outside the canvas, while a value of `1`, `2` or `3` will restrict the crop box to the size of the canvas. A `viewMode` of `2` or `3` will additionally restrict the canvas to the container. Note that if the proportions of the canvas and the container are the same, there is no difference between `2` and `3`. 171 | 172 | ### dragMode 173 | 174 | - Type: `String` 175 | - Default: `'crop'` 176 | - Options: 177 | - `'crop'`: create a new crop box 178 | - `'move'`: move the canvas 179 | - `'none'`: do nothing 180 | 181 | Define the dragging mode of the cropper. 182 | 183 | ### initialAspectRatio 184 | 185 | - Type: `Number` 186 | - Default: `NaN` 187 | 188 | Define the initial aspect ratio of the crop box. By default, it is the same as the aspect ratio of the canvas (image wrapper). 189 | 190 | > Only available when the `aspectRatio` option is set to `NaN`. 191 | 192 | ### aspectRatio 193 | 194 | - Type: `Number` 195 | - Default: `NaN` 196 | 197 | Define the fixed aspect ratio of the crop box. By default, the crop box is free ratio. 198 | 199 | ### data 200 | 201 | - Type: `Object` 202 | - Default: `null` 203 | 204 | The previous cropped data if you had stored, will be passed to `setData` method automatically when initialized. Only available when the `autoCrop` option is set to `true`. 205 | 206 | ### preview 207 | 208 | - Type: `Element`, `Array` (elements), `NodeList` or `String` (selector) 209 | - Default: `''` 210 | - An element or an array of elements or a node list object or a valid selector for [Document.querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) 211 | 212 | Add extra elements (containers) for preview. 213 | 214 | **Notes:** 215 | 216 | - The maximum width is the initial width of the preview container. 217 | - The maximum height is the initial height of the preview container. 218 | - If you set an `aspectRatio` option, be sure to set the same aspect ratio to the preview container. 219 | - If the preview is not getting properly displayed, set `overflow: hidden` style to the preview container. 220 | 221 | ### responsive 222 | 223 | - Type: `Boolean` 224 | - Default: `true` 225 | 226 | Re-render the cropper when resizing the window. 227 | 228 | ### restore 229 | 230 | - Type: `Boolean` 231 | - Default: `true` 232 | 233 | Restore the cropped area after resizing the window. 234 | 235 | ### checkCrossOrigin 236 | 237 | - Type: `Boolean` 238 | - Default: `true` 239 | 240 | Check if the current image is a cross-origin image. 241 | 242 | If it is, when clone the image, a `crossOrigin` attribute will be added to the cloned image element and a timestamp will be added to the `src` attribute to reload the source image to avoid browser cache error. 243 | 244 | By adding `crossOrigin` attribute to image element will stop adding timestamp to image URL and stop reload of image, but the request (XMLHttpRequest) to read the image data for orientation checking will require a timestamp to bust cache to avoid browser cache error now, you can set the `checkOrientation` option to `false` to cancel this request. 245 | 246 | If the value of the image's `crossOrigin` attribute is `"use-credentials"`, then the `withCredentials` attribute will set to `true` when read the image data by XMLHttpRequest. 247 | 248 | ### checkOrientation 249 | 250 | - Type: `Boolean` 251 | - Default: `true` 252 | 253 | Check the current image's Exif Orientation information. Note that only a JPEG image may contains Exif Orientation information. 254 | 255 | More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation value with `1` (the default value) to avoid some issues ([1](https://github.com/fengyuanchen/cropper/issues/120), [2](https://github.com/fengyuanchen/cropper/issues/509)) on iOS devices. 256 | 257 | Requires to set both the `rotatable` and `scalable` options to `true` at the same time. 258 | 259 | **Note:** Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values. 260 | 261 | > Requires [Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) support ([IE 10+](http://caniuse.com/typedarrays)). 262 | 263 | ### modal 264 | 265 | - Type: `Boolean` 266 | - Default: `true` 267 | 268 | Show the black modal above the image and under the crop box. 269 | 270 | ### guides 271 | 272 | - Type: `Boolean` 273 | - Default: `true` 274 | 275 | Show the dashed lines above the crop box. 276 | 277 | ### center 278 | 279 | - Type: `Boolean` 280 | - Default: `true` 281 | 282 | Show the center indicator above the crop box. 283 | 284 | ### highlight 285 | 286 | - Type: `Boolean` 287 | - Default: `true` 288 | 289 | Show the white modal above the crop box (highlight the crop box). 290 | 291 | ### background 292 | 293 | - Type: `Boolean` 294 | - Default: `true` 295 | 296 | Show the grid background of the container. 297 | 298 | ### autoCrop 299 | 300 | - Type: `Boolean` 301 | - Default: `true` 302 | 303 | Enable to crop the image automatically when initialized. 304 | 305 | ### autoCropArea 306 | 307 | - Type: `Number` 308 | - Default: `0.8` (80% of the image) 309 | 310 | A number between 0 and 1. Define the automatic cropping area size (percentage). 311 | 312 | ### movable 313 | 314 | - Type: `Boolean` 315 | - Default: `true` 316 | 317 | Enable to move the image. 318 | 319 | ### rotatable 320 | 321 | - Type: `Boolean` 322 | - Default: `true` 323 | 324 | Enable to rotate the image. 325 | 326 | ### scalable 327 | 328 | - Type: `Boolean` 329 | - Default: `true` 330 | 331 | Enable to scale the image. 332 | 333 | ### zoomable 334 | 335 | - Type: `Boolean` 336 | - Default: `true` 337 | 338 | Enable to zoom the image. 339 | 340 | ### zoomOnTouch 341 | 342 | - Type: `Boolean` 343 | - Default: `true` 344 | 345 | Enable to zoom the image by dragging touch. 346 | 347 | ### zoomOnWheel 348 | 349 | - Type: `Boolean` 350 | - Default: `true` 351 | 352 | Enable to zoom the image by wheeling mouse. 353 | 354 | ### wheelZoomRatio 355 | 356 | - Type: `Number` 357 | - Default: `0.1` 358 | 359 | Define zoom ratio when zooming the image by wheeling mouse. 360 | 361 | ### cropBoxMovable 362 | 363 | - Type: `Boolean` 364 | - Default: `true` 365 | 366 | Enable to move the crop box by dragging. 367 | 368 | ### cropBoxResizable 369 | 370 | - Type: `Boolean` 371 | - Default: `true` 372 | 373 | Enable to resize the crop box by dragging. 374 | 375 | ### toggleDragModeOnDblclick 376 | 377 | - Type: `Boolean` 378 | - Default: `true` 379 | 380 | Enable to toggle drag mode between "crop" and "move" when clicking twice on the cropper. 381 | 382 | > Requires [`dblclick`](https://developer.mozilla.org/en-US/docs/Web/Events/dblclick) event support. 383 | 384 | ### minContainerWidth 385 | 386 | - Type: `Number` 387 | - Default: `200` 388 | 389 | The minimum width of the container. 390 | 391 | ### minContainerHeight 392 | 393 | - Type: `Number` 394 | - Default: `100` 395 | 396 | The minimum height of the container. 397 | 398 | ### minCanvasWidth 399 | 400 | - Type: `Number` 401 | - Default: `0` 402 | 403 | The minimum width of the canvas (image wrapper). 404 | 405 | ### minCanvasHeight 406 | 407 | - Type: `Number` 408 | - Default: `0` 409 | 410 | The minimum height of the canvas (image wrapper). 411 | 412 | ### minCropBoxWidth 413 | 414 | - Type: `Number` 415 | - Default: `0` 416 | 417 | The minimum width of the crop box. 418 | 419 | **Note:** This size is relative to the page, not the image. 420 | 421 | ### minCropBoxHeight 422 | 423 | - Type: `Number` 424 | - Default: `0` 425 | 426 | The minimum height of the crop box. 427 | 428 | **Note:** This size is relative to the page, not the image. 429 | 430 | ### ready 431 | 432 | - Type: `Function` 433 | - Default: `null` 434 | 435 | A shortcut of the `ready` event. 436 | 437 | ### cropstart 438 | 439 | - Type: `Function` 440 | - Default: `null` 441 | 442 | A shortcut of the `cropstart` event. 443 | 444 | ### cropmove 445 | 446 | - Type: `Function` 447 | - Default: `null` 448 | 449 | A shortcut of the `cropmove` event. 450 | 451 | ### cropend 452 | 453 | - Type: `Function` 454 | - Default: `null` 455 | 456 | A shortcut of the `cropend` event. 457 | 458 | ### crop 459 | 460 | - Type: `Function` 461 | - Default: `null` 462 | 463 | A shortcut of the `crop` event. 464 | 465 | ### zoom 466 | 467 | - Type: `Function` 468 | - Default: `null` 469 | 470 | A shortcut of the `zoom` event. 471 | 472 | [⬆ back to top](#table-of-contents) 473 | 474 | ## Methods 475 | 476 | As there is an **asynchronous** process when loading the image, you **should call most of the methods after ready**, except "setAspectRatio", "replace" and "destroy". 477 | 478 | > If a method doesn't need to return any value, it will return the cropper instance (`this`) for chain composition. 479 | 480 | ```js 481 | new Cropper(image, { 482 | ready() { 483 | // this.cropper[method](argument1, , argument2, ..., argumentN); 484 | this.cropper.move(1, -1); 485 | 486 | // Allows chain composition 487 | this.cropper.move(1, -1).rotate(45).scale(1, -1); 488 | }, 489 | }); 490 | ``` 491 | 492 | ### crop() 493 | 494 | Show the crop box manually. 495 | 496 | ```js 497 | new Cropper(image, { 498 | autoCrop: false, 499 | ready() { 500 | // Do something here 501 | // ... 502 | 503 | // And then 504 | this.cropper.crop(); 505 | }, 506 | }); 507 | ``` 508 | 509 | ### reset() 510 | 511 | Reset the image and crop box to their initial states. 512 | 513 | ### clear() 514 | 515 | Clear the crop box. 516 | 517 | ### replace(url[, hasSameSize]) 518 | 519 | - **url**: 520 | - Type: `String` 521 | - A new image url. 522 | 523 | - **hasSameSize** (optional): 524 | - Type: `Boolean` 525 | - Default: `false` 526 | - If the new image has the same size as the old one, then it will not rebuild the cropper and only update the URLs of all related images. This can be used for applying filters. 527 | 528 | Replace the image's src and rebuild the cropper. 529 | 530 | ### enable() 531 | 532 | Enable (unfreeze) the cropper. 533 | 534 | ### disable() 535 | 536 | Disable (freeze) the cropper. 537 | 538 | ### destroy() 539 | 540 | Destroy the cropper and remove the instance from the image. 541 | 542 | ### move(offsetX[, offsetY]) 543 | 544 | - **offsetX**: 545 | - Type: `Number` 546 | - Moving size (px) in the horizontal direction. 547 | 548 | - **offsetY** (optional): 549 | - Type: `Number` 550 | - Moving size (px) in the vertical direction. 551 | - If not present, its default value is `offsetX`. 552 | 553 | Move the canvas (image wrapper) with relative offsets. 554 | 555 | ```js 556 | cropper.move(1); 557 | cropper.move(1, 0); 558 | cropper.move(0, -1); 559 | ``` 560 | 561 | ### moveTo(x[, y]) 562 | 563 | - **x**: 564 | - Type: `Number` 565 | - The `left` value of the canvas 566 | 567 | - **y** (optional): 568 | - Type: `Number` 569 | - The `top` value of the canvas 570 | - If not present, its default value is `x`. 571 | 572 | Move the canvas (image wrapper) to an absolute point. 573 | 574 | ### zoom(ratio) 575 | 576 | - **ratio**: 577 | - Type: `Number` 578 | - Zoom in: requires a positive number (ratio > 0) 579 | - Zoom out: requires a negative number (ratio < 0) 580 | 581 | Zoom the canvas (image wrapper) with a relative ratio. 582 | 583 | ```js 584 | cropper.zoom(0.1); 585 | cropper.zoom(-0.1); 586 | ``` 587 | 588 | ### zoomTo(ratio[, pivot]) 589 | 590 | - **ratio**: 591 | - Type: `Number` 592 | - Requires a positive number (ratio > 0) 593 | 594 | - **pivot** (optional): 595 | - Type: `Object` 596 | - Schema: `{ x: Number, y: Number }` 597 | - The coordinate of the center point for zooming, base on the top left corner of the cropper container. 598 | 599 | Zoom the canvas (image wrapper) to an absolute ratio. 600 | 601 | ```js 602 | cropper.zoomTo(1); // 1:1 (canvasData.width === canvasData.naturalWidth) 603 | 604 | const containerData = cropper.getContainerData(); 605 | 606 | // Zoom to 50% from the center of the container. 607 | cropper.zoomTo(.5, { 608 | x: containerData.width / 2, 609 | y: containerData.height / 2, 610 | }); 611 | ``` 612 | 613 | ### rotate(degree) 614 | 615 | - **degree**: 616 | - Type: `Number` 617 | - Rotate right: requires a positive number (degree > 0) 618 | - Rotate left: requires a negative number (degree < 0) 619 | 620 | Rotate the image with a relative degree. 621 | 622 | > Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)). 623 | 624 | ```js 625 | cropper.rotate(90); 626 | cropper.rotate(-90); 627 | ``` 628 | 629 | ### rotateTo(degree) 630 | 631 | - **degree**: 632 | - Type: `Number` 633 | 634 | Rotate the image to an absolute degree. 635 | 636 | ### scale(scaleX[, scaleY]) 637 | 638 | - **scaleX**: 639 | - Type: `Number` 640 | - Default: `1` 641 | - The scaling factor to apply to the abscissa of the image. 642 | - When equal to `1` it does nothing. 643 | 644 | - **scaleY** (optional): 645 | - Type: `Number` 646 | - The scaling factor to apply on the ordinate of the image. 647 | - If not present, its default value is `scaleX`. 648 | 649 | Scale the image. 650 | 651 | > Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)). 652 | 653 | ```js 654 | cropper.scale(-1); // Flip both horizontal and vertical 655 | cropper.scale(-1, 1); // Flip horizontal 656 | cropper.scale(1, -1); // Flip vertical 657 | ``` 658 | 659 | ### scaleX(scaleX) 660 | 661 | - **scaleX**: 662 | - Type: `Number` 663 | - Default: `1` 664 | - The scaling factor to apply to the abscissa of the image. 665 | - When equal to `1` it does nothing. 666 | 667 | Scale the abscissa of the image. 668 | 669 | ### scaleY(scaleY) 670 | 671 | - **scaleY**: 672 | - Type: `Number` 673 | - Default: `1` 674 | - The scaling factor to apply on the ordinate of the image. 675 | - When equal to `1` it does nothing. 676 | 677 | Scale the ordinate of the image. 678 | 679 | ### getData([rounded]) 680 | 681 | - **rounded** (optional): 682 | - Type: `Boolean` 683 | - Default: `false` 684 | - Set `true` to get rounded values. 685 | 686 | - (return value): 687 | - Type: `Object` 688 | - Properties: 689 | - `x`: the offset left of the cropped area 690 | - `y`: the offset top of the cropped area 691 | - `width`: the width of the cropped area 692 | - `height`: the height of the cropped area 693 | - `rotate`: the rotated degrees of the image 694 | - `scaleX`: the scaling factor to apply on the abscissa of the image 695 | - `scaleY`: the scaling factor to apply on the ordinate of the image 696 | 697 | Output the final cropped area position and size data (base on the natural size of the original image). 698 | 699 | > You can send the data to server-side to crop the image directly: 700 | > 701 | > 1. Rotate the image with the `rotate` property. 702 | > 2. Scale the image with the `scaleX` and `scaleY` properties. 703 | > 3. Crop the image with the `x`, `y`, `width` and `height` properties. 704 | 705 | ![A schematic diagram for data's properties](docs/images/data.jpg) 706 | 707 | ### setData(data) 708 | 709 | - **data**: 710 | - Type: `Object` 711 | - Properties: See the [`getData`](#getdatarounded) method. 712 | - You may need to round the data properties before passing them in. 713 | 714 | Change the cropped area position and size with new data (base on the original image). 715 | 716 | > **Note:** This method only available when the value of the `viewMode` option is greater than or equal to `1`. 717 | 718 | ### getContainerData() 719 | 720 | - (return value): 721 | - Type: `Object` 722 | - Properties: 723 | - `width`: the current width of the container 724 | - `height`: the current height of the container 725 | 726 | Output the container size data. 727 | 728 | ![A schematic diagram for cropper's layers](docs/images/layers.jpg) 729 | 730 | ### getImageData() 731 | 732 | - (return value): 733 | - Type: `Object` 734 | - Properties: 735 | - `left`: the offset left of the image 736 | - `top`: the offset top of the image 737 | - `width`: the width of the image 738 | - `height`: the height of the image 739 | - `naturalWidth`: the natural width of the image 740 | - `naturalHeight`: the natural height of the image 741 | - `aspectRatio`: the aspect ratio of the image 742 | - `rotate`: the rotated degrees of the image if rotated 743 | - `scaleX`: the scaling factor to apply on the abscissa of the image if scaled 744 | - `scaleY`: the scaling factor to apply on the ordinate of the image if scaled 745 | 746 | Output the image position, size, and other related data. 747 | 748 | ### getCanvasData() 749 | 750 | - (return value): 751 | - Type: `Object` 752 | - Properties: 753 | - `left`: the offset left of the canvas 754 | - `top`: the offset top of the canvas 755 | - `width`: the width of the canvas 756 | - `height`: the height of the canvas 757 | - `naturalWidth`: the natural width of the canvas (read only) 758 | - `naturalHeight`: the natural height of the canvas (read only) 759 | 760 | Output the canvas (image wrapper) position and size data. 761 | 762 | ```js 763 | const imageData = cropper.getImageData(); 764 | const canvasData = cropper.getCanvasData(); 765 | 766 | if (imageData.rotate % 180 === 0) { 767 | console.log(canvasData.naturalWidth === imageData.naturalWidth); 768 | // > true 769 | } 770 | ``` 771 | 772 | ### setCanvasData(data) 773 | 774 | - **data**: 775 | - Type: `Object` 776 | - Properties: 777 | - `left`: the new offset left of the canvas 778 | - `top`: the new offset top of the canvas 779 | - `width`: the new width of the canvas 780 | - `height`: the new height of the canvas 781 | 782 | Change the canvas (image wrapper) position and size with new data. 783 | 784 | ### getCropBoxData() 785 | 786 | - (return value): 787 | - Type: `Object` 788 | - Properties: 789 | - `left`: the offset left of the crop box 790 | - `top`: the offset top of the crop box 791 | - `width`: the width of the crop box 792 | - `height`: the height of the crop box 793 | 794 | Output the crop box position and size data. 795 | 796 | ### setCropBoxData(data) 797 | 798 | - **data**: 799 | - Type: `Object` 800 | - Properties: 801 | - `left`: the new offset left of the crop box 802 | - `top`: the new offset top of the crop box 803 | - `width`: the new width of the crop box 804 | - `height`: the new height of the crop box 805 | 806 | Change the crop box position and size with new data. 807 | 808 | ### getCroppedCanvas([options]) 809 | 810 | - **options** (optional): 811 | - Type: `Object` 812 | - Properties: 813 | - `width`: the destination width of the output canvas. 814 | - `height`: the destination height of the output canvas. 815 | - `minWidth`: the minimum destination width of the output canvas, the default value is `0`. 816 | - `minHeight`: the minimum destination height of the output canvas, the default value is `0`. 817 | - `maxWidth`: the maximum destination width of the output canvas, the default value is `Infinity`. 818 | - `maxHeight`: the maximum destination height of the output canvas, the default value is `Infinity`. 819 | - `fillColor`: a color to fill any alpha values in the output canvas, the default value is `transparent`. 820 | - [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled): set to change if images are smoothed (`true`, default) or not (`false`). 821 | - [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality): set the quality of image smoothing, one of "low" (default), "medium", or "high". 822 | 823 | - (return value): 824 | - Type: `HTMLCanvasElement` 825 | - A canvas drawn the cropped image. 826 | 827 | - Notes: 828 | - The aspect ratio of the output canvas will be fitted to the aspect ratio of the crop box automatically. 829 | - If you intend to get a JPEG image from the output canvas, you should set the `fillColor` option first, if not, the transparent part in the JPEG image will become black by default. 830 | - Uses the Browser's native [canvas.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) API to do the compression work, which means it is **lossy compression**. For better image quality, you can upload the original image and the cropped data to a server and do the crop work on the server. 831 | 832 | - Browser support: 833 | - Basic image: requires [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) support ([IE 9+](http://caniuse.com/canvas)). 834 | - Rotated image: requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)). 835 | - Cross-origin image: requires HTML5 [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) support ([IE 11+](http://caniuse.com/cors)). 836 | 837 | Get a canvas drawn the cropped image (lossy compression). If it is not cropped, then returns a canvas drawn the whole image. 838 | 839 | > After then, you can display the canvas as an image directly, or use [HTMLCanvasElement.toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL) to get a Data URL, or use [HTMLCanvasElement.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) to get a blob and upload it to server with [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) if the browser supports these APIs. 840 | 841 | Avoid to get a blank output image, you might need to set the `maxWidth` and `maxHeight` properties to limited numbers, because of [the size limits of a canvas element](https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element). 842 | 843 | ```js 844 | cropper.getCroppedCanvas(); 845 | 846 | cropper.getCroppedCanvas({ 847 | width: 160, 848 | height: 90, 849 | minWidth: 256, 850 | minHeight: 256, 851 | maxWidth: 4096, 852 | maxHeight: 4096, 853 | fillColor: '#fff', 854 | imageSmoothingEnabled: false, 855 | imageSmoothingQuality: 'high', 856 | }); 857 | 858 | // Upload cropped image to server if the browser supports `HTMLCanvasElement.toBlob`. 859 | // The default value for the second parameter of `toBlob` is 'image/png', change it if necessary. 860 | cropper.getCroppedCanvas().toBlob((blob) => { 861 | const formData = new FormData(); 862 | 863 | // Pass the image file name as the third parameter if necessary. 864 | formData.append('croppedImage', blob/*, 'example.png' */); 865 | 866 | // Use `jQuery.ajax` method for example 867 | $.ajax('/path/to/upload', { 868 | method: "POST", 869 | data: formData, 870 | processData: false, 871 | contentType: false, 872 | success() { 873 | console.log('Upload success'); 874 | }, 875 | error() { 876 | console.log('Upload error'); 877 | }, 878 | }); 879 | }/*, 'image/png' */); 880 | ``` 881 | 882 | ### setAspectRatio(aspectRatio) 883 | 884 | - **aspectRatio**: 885 | - Type: `Number` 886 | - Requires a positive number. 887 | 888 | Change the aspect ratio of the crop box. 889 | 890 | ### setDragMode([mode]) 891 | 892 | - **mode** (optional): 893 | - Type: `String` 894 | - Default: `'none'` 895 | - Options: `'none'`, `'crop'`, `'move'` 896 | 897 | Change the drag mode. 898 | 899 | **Tips:** You can toggle the "crop" and "move" mode by double click on the cropper. 900 | 901 | [⬆ back to top](#table-of-contents) 902 | 903 | ## Events 904 | 905 | ### ready 906 | 907 | This event fires when the target image has been loaded and the cropper instance is ready for operating. 908 | 909 | ```js 910 | let cropper; 911 | 912 | image.addEventListener('ready', function () { 913 | console.log(this.cropper === cropper); 914 | // > true 915 | }); 916 | 917 | cropper = new Cropper(image); 918 | ``` 919 | 920 | ### cropstart 921 | 922 | - **event.detail.originalEvent**: 923 | - Type: `Event` 924 | - Options: `mousedown`, `touchstart` and `pointerdown` 925 | 926 | - **event.detail.action**: 927 | - Type: `String` 928 | - Options: 929 | - `'crop'`: create a new crop box 930 | - `'move'`: move the canvas (image wrapper) 931 | - `'zoom'`: zoom in / out the canvas (image wrapper) by touch. 932 | - `'e'`: resize the east side of the crop box 933 | - `'w'`: resize the west side of the crop box 934 | - `'s'`: resize the south side of the crop box 935 | - `'n'`: resize the north side of the crop box 936 | - `'se'`: resize the southeast side of the crop box 937 | - `'sw'`: resize the southwest side of the crop box 938 | - `'ne'`: resize the northeast side of the crop box 939 | - `'nw'`: resize the northwest side of the crop box 940 | - `'all'`: move the crop box (all directions) 941 | 942 | This event fires when the canvas (image wrapper) or the crop box starts to change. 943 | 944 | ```js 945 | image.addEventListener('cropstart', (event) => { 946 | console.log(event.detail.originalEvent); 947 | console.log(event.detail.action); 948 | }); 949 | ``` 950 | 951 | ### cropmove 952 | 953 | - **event.detail.originalEvent**: 954 | - Type: `Event` 955 | - Options: `mousemove`, `touchmove` and `pointermove`. 956 | 957 | - **event.detail.action**: the same as "cropstart". 958 | 959 | This event fires when the canvas (image wrapper) or the crop box is changing. 960 | 961 | ### cropend 962 | 963 | - **event.detail.originalEvent**: 964 | - Type: `Event` 965 | - Options: `mouseup`, `touchend`, `touchcancel`, `pointerup` and `pointercancel`. 966 | 967 | - **event.detail.action**: the same as "cropstart". 968 | 969 | This event fires when the canvas (image wrapper) or the crop box stops to change. 970 | 971 | ### crop 972 | 973 | - **event.detail.x** 974 | - **event.detail.y** 975 | - **event.detail.width** 976 | - **event.detail.height** 977 | - **event.detail.rotate** 978 | - **event.detail.scaleX** 979 | - **event.detail.scaleY** 980 | 981 | > About these properties, see the [`getData`](#getdatarounded) method. 982 | 983 | This event fires when the canvas (image wrapper) or the crop box changed. 984 | 985 | **Notes:** 986 | 987 | - When the `autoCrop` option is set to `true`, a `crop` event will be triggered before the `ready` event. 988 | - When the `data` option is set, another `crop` event will be triggered before the `ready` event. 989 | 990 | ### zoom 991 | 992 | - **event.detail.originalEvent**: 993 | - Type: `Event` 994 | - Options: `wheel`, `touchmove`. 995 | 996 | - **event.detail.oldRatio**: 997 | - Type: `Number` 998 | - The old (current) ratio of the canvas 999 | 1000 | - **event.detail.ratio**: 1001 | - Type: `Number` 1002 | - The new (next) ratio of the canvas (`canvasData.width / canvasData.naturalWidth`) 1003 | 1004 | This event fires when a cropper instance starts to zoom in or zoom out its canvas (image wrapper). 1005 | 1006 | ```js 1007 | image.addEventListener('zoom', (event) => { 1008 | // Zoom in 1009 | if (event.detail.ratio > event.detail.oldRatio) { 1010 | event.preventDefault(); // Prevent zoom in 1011 | } 1012 | 1013 | // Zoom out 1014 | // ... 1015 | }); 1016 | ``` 1017 | 1018 | [⬆ back to top](#table-of-contents) 1019 | 1020 | ## No conflict 1021 | 1022 | If you have to use another cropper with the same namespace, just call the `Cropper.noConflict` static method to revert to it. 1023 | 1024 | ```html 1025 | 1026 | 1027 | 1031 | ``` 1032 | 1033 | ## Browser support 1034 | 1035 | - Chrome (latest) 1036 | - Firefox (latest) 1037 | - Safari (latest) 1038 | - Opera (latest) 1039 | - Edge (latest) 1040 | - Internet Explorer 9+ 1041 | 1042 | ## Contributing 1043 | 1044 | Please read through our [contributing guidelines](.github/CONTRIBUTING.md). 1045 | 1046 | ## Versioning 1047 | 1048 | Maintained under the [Semantic Versioning guidelines](https://semver.org/). 1049 | 1050 | ## License 1051 | 1052 | [MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com) 1053 | 1054 | ## Related projects 1055 | 1056 | - [angular-cropperjs](https://github.com/matheusdavidson/angular-cropperjs) by @matheusdavidson 1057 | - [ember-cropperjs](https://github.com/danielthall/ember-cropperjs) by @danielthall 1058 | - [iron-cropper](https://github.com/safetychanger/iron-cropper) by @safetychanger 1059 | - [react-cropper](https://github.com/roadmanfong/react-cropper) by @roadmanfong 1060 | - [vue-cropperjs](https://github.com/Agontuk/vue-cropperjs) by @Agontuk 1061 | 1062 | [⬆ back to top](#table-of-contents) 1063 | -------------------------------------------------------------------------------- /SlashUploader/server/UploadFiles.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" ContentType="text/html" Debug="True" %> 2 | 3 | <%@ Import Namespace="System.IO" %> 4 | <%@ Import Namespace="System.Drawing" %> 5 | <%@ Import Namespace="System.Drawing.Drawing2D" %> 6 | <%@ Import Namespace="System.Security.AccessControl" %> 7 | <%@ Import Namespace="System.Security.Principal" %> 8 | <% 9 | 10 | /* 11 | * SlashUploader - JS plugin - Version 1.5.9 12 | * http://slashuploader.com/ 13 | * Copyright (c) 2018-present Slash Apps Development, http://slash.co.il/ 14 | * Licensed under the MIT License [https://en.wikipedia.org/wiki/MIT_License] 15 | */ 16 | 17 | Response.AppendHeader("Access-Control-Allow-Origin", "*"); 18 | 19 | string FileFolder = "./uploads/"; 20 | bool DoOverwriteFilename = false; 21 | bool SaveFileWithGuidFilename = false; 22 | String[] AllowedFilesTypes = { 23 | "jpg", "png", "gif", "jpeg", "bmp", "tiff", "webp", "jfif", // Images 24 | "3gp2", "3gpp", "3gpp2", "asf", "asx", "avi", "flv", "m4v", "mkv", "mov", "mpeg", "mpg", "mpe", "m1s", "mpa", "mp2", "m2a", "mp2v", "m2v", "m2s", "mp4", "ogg", "rm", "wmv", "mp4", "qt", "ogm", "vob", "webm", "787", // Videos 25 | "3gp", "act", "aiff", "aac", "alac", "amr", "atrac", "au", "awb", "dct", "dss", "dvf", "flac", "gsm", "iklax", "ivs", "m4a", "m4p", "mmf", "mp3", "mpc", "msv", "ogg", "opus", "raw", "tta", "vox", "wav", "wma", // Audios 26 | "txt", // plain Text 27 | "doc", "docb", "docm", "docx", "dot", "dotm", "dotx", "pdf", "pot", "potm", "potx", "ppam", "pps", "ppsx", "ppt", "pptm", "pptx", "sldm", "sldx", // Docs 28 | "csv", "xla", "xlam", "xll", "xlm", "xls","xlsb", "xslm", "xlsx", "xlt", "xltm", "xltx", "xlw" // Excel 29 | }; 30 | 31 | StartUpload(FileFolder, DoOverwriteFilename, SaveFileWithGuidFilename, AllowedFilesTypes); 32 | %> 33 | 1113 | --------------------------------------------------------------------------------