image-uploaders.blade.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!--- image-uploaders --->
  2. <div class="modal fade" id="modal-image-uploaders" aria-hidden="true" data-backdrop="static" style="z-index: 1050; overflow: auto;">
  3. <div class="modal-dialog m-auto pt-4" style="width: 620px;">
  4. <div class="modal-content">
  5. <div class="modal-header bg-purple-800 ">
  6. <h4 class="modal-title text-white" id="myModalLabel">미디어 서브이미지 업로더</h4>
  7. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fas fa-times"></i></button>
  8. </div>
  9. <div class="modal-body p-2" style="background-color: #f5f5f5;">
  10. <input type="hidden" id="bd-file-url">
  11. <div class="mt-4 card">
  12. <div class="dropzone" id="fileDropzone">
  13. </div>
  14. </div>
  15. <div class="position-absolute" style="top: 3px; right: 10px;">
  16. <button type="button" class="font-weight-bold btn btn-danger btn-sm icon-copy3 complete-memo-btn"
  17. id="btn-upload-file">
  18. </button>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. @once
  25. <link href="{{ csset('/css/uploaders/dropzone.css') }}" rel="stylesheet" type="text/css">
  26. <script src="{{ csset('/js/plugins/uploaders/dropzone.js') }}"></script>
  27. <script>
  28. $(document).on('modal.show', '#media-form', async function (event, bd_file_url) {
  29. $('#modal-image-uploaders').find('#bd-file-url').val(bd_file_url)
  30. });
  31. Dropzone.options.fileDropzone = {
  32. paramName: 'file',
  33. url: '/sub-image-correction',
  34. headers: {
  35. 'x-csrf-token': $('meta[name="csrf-token"]').attr('content'),
  36. },
  37. acceptedFiles: ".jpeg,.jpg,.png,.gif,.JPEG,.JPG,.PNG,.GIF",
  38. init: function () {
  39. var submitButton = document.querySelector("#btn-upload-file");
  40. var myDropzone = this;
  41. submitButton.addEventListener("click", function () {
  42. myDropzone.processQueue();
  43. });
  44. },
  45. autoProcessQueue: false, // 자동업로드 여부 (true일 경우, 바로 업로드 되어지며, false일 경우, 서버에는 올라가지 않은 상태임 processQueue() 호출시 올라간다.)
  46. clickable: true, // 클릭가능여부
  47. thumbnailHeight: 90, // Upload icon size
  48. thumbnailWidth: 90, // Upload icon size
  49. // maxFiles: 1, // 업로드 파일수
  50. // maxFilesize: 100, // 최대업로드용량 : 100MB
  51. parallelUploads: 1, // 동시파일업로드 수(이걸 지정한 수 만큼 여러파일을 한번에 컨트롤러에 넘긴다.)
  52. addRemoveLinks: true, // 삭제버튼 표시 여부
  53. dictRemoveFile: '삭제', // 삭제버튼 표시 텍스트
  54. uploadMultiple: false, // 다중업로드 기능
  55. success: function(file, response)
  56. {
  57. if (isEmptyArr(response)) {
  58. iziToast.error({ title: 'Error', message: $('#no-data-found').text() });
  59. return;
  60. }
  61. $('#modal-image-uploaders').trigger('image.upload', [response, $('#modal-image-uploaders').find('#bd-file-url').val()]);
  62. $('#modal-image-uploaders.show').modal('hide')
  63. },
  64. error: function(file, response)
  65. {
  66. iziToast.error({ title: 'Error', message: 'image upload error' });
  67. return false;
  68. }
  69. };
  70. // $(document).on('shown.bs.modal','#modal-uploaders', function (e) {
  71. // })
  72. </script>
  73. @endonce