728x90 반응형 image2 [Toast-UI Editor] 이미지 업로드 기능 변경 Toast UI Editor에서 이미지 업로드를 하면 base64 형식으로 에디터에 입력됩니다. base64 형식은 해상도가 올라갈수록 글자수가 어마어마하게 늘어나서, servlet의 max-file-size와 max-request-size를 초과할 수 있습니다. 그리고 그대로 DB에 저장하고 싶지 않겠죠? Toast UI Editor API 문서를 확인해 보면 다음과 같은 기능이 존재합니다. 다음은 addImageBlobHook으로 file에서 받아온 이미지 데이터를 업로드 후 url로 처리하는 로직입니다. const editor = new toastui.Editor({ el: document.querySelector(selectors), height: '300px', initialEditType: '.. 2023. 3. 20. [javascript] 이미지 용량 줄이기 (이미지 리사이징) Compressor.js spring.servlet.multipart.max-file-size 설정하여 파일 업로드 용량 제한을 걸어두었는데, 프론트단에서 이미지 파일 용량 상관없이 이미지 파일 업로드를 하려고 합니다. 이미지 용량을 줄이기 위한 방법을 찾으려고 구글링을 했는데 열에 아홉은 아래 스크립트에 관한 글이었습니다. window.resize = (function () { function Resize(){ } Resize.prototype = { init: function(outputQuality) { this.outputQuality = (outputQuality === 'undefined' ? 1 : outputQuality); }, photo: function(file, maxSize, outputType, call.. 2020. 11. 13. 이전 1 다음 728x90 반응형