@@ -8,18 +8,17 @@ import NotesContext from "../../Context/NotesContext"
88import Modal , { ModalProps } from "../../Shared/Components/Modal/Modal"
99import { downscaleImage } from "../../Shared/downscaleImage"
1010
11- const MAX_PAYLOAD_SIZE = 100 * 1024
11+ const MAX_PAYLOAD_SIZE = 1000000
1212
1313/**
1414 * Сжатие url изображения c проверкой размера
1515 * @param {String } uncompressed
1616 * @param {String } type
1717 */
1818async function getCompressed ( uncompressed , type ) {
19- if ( uncompressed . length < MAX_PAYLOAD_SIZE ) return uncompressed
20- const smallcompressedRes = await downscaleImage ( uncompressed , type , 480 )
19+ const smallcompressedRes = await downscaleImage ( uncompressed , type , 720 )
2120 if ( smallcompressedRes . length < MAX_PAYLOAD_SIZE ) return smallcompressedRes
22- const mediumcompressedRes = await downscaleImage ( uncompressed , type , 360 )
21+ const mediumcompressedRes = await downscaleImage ( uncompressed , type , 480 )
2322 if ( mediumcompressedRes . length < MAX_PAYLOAD_SIZE ) return mediumcompressedRes
2423 const extracompressedRes = await downscaleImage ( uncompressed , type , 240 )
2524 if ( extracompressedRes . length < MAX_PAYLOAD_SIZE ) return extracompressedRes
@@ -105,7 +104,7 @@ function Media({ setNoteMedia, mediaList = [], style, className, disabled, noteI
105104 const src = typeof media === "object" && media && media . data
106105 return (
107106 < div className = "card p-1 m-1" key = { imgId } style = { { position : "relative" } } >
108- < img className = "img-fluid" style = { { maxWidth : "35em" , maxHeight : "15em" } } src = { src } alt = "note img" > </ img >
107+ < img className = "img-fluid" style = { { maxWidth : "35em" , maxHeight : "15em" } } src = { src } alt = "note img" > </ img >
109108 < button
110109 style = { { position : "absolute" , bottom : "0" , right : "0" , lineHeight : "1em" , padding : "0.05em" } }
111110 className = { `btn btn-danger m-1` }
0 commit comments