@@ -8,18 +8,17 @@ import NotesContext from "../../Context/NotesContext"
8
8
import Modal , { ModalProps } from "../../Shared/Components/Modal/Modal"
9
9
import { downscaleImage } from "../../Shared/downscaleImage"
10
10
11
- const MAX_PAYLOAD_SIZE = 100 * 1024
11
+ const MAX_PAYLOAD_SIZE = 1000000
12
12
13
13
/**
14
14
* Сжатие url изображения c проверкой размера
15
15
* @param {String } uncompressed
16
16
* @param {String } type
17
17
*/
18
18
async 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 )
21
20
if ( smallcompressedRes . length < MAX_PAYLOAD_SIZE ) return smallcompressedRes
22
- const mediumcompressedRes = await downscaleImage ( uncompressed , type , 360 )
21
+ const mediumcompressedRes = await downscaleImage ( uncompressed , type , 480 )
23
22
if ( mediumcompressedRes . length < MAX_PAYLOAD_SIZE ) return mediumcompressedRes
24
23
const extracompressedRes = await downscaleImage ( uncompressed , type , 240 )
25
24
if ( extracompressedRes . length < MAX_PAYLOAD_SIZE ) return extracompressedRes
@@ -105,7 +104,7 @@ function Media({ setNoteMedia, mediaList = [], style, className, disabled, noteI
105
104
const src = typeof media === "object" && media && media . data
106
105
return (
107
106
< 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 >
109
108
< button
110
109
style = { { position : "absolute" , bottom : "0" , right : "0" , lineHeight : "1em" , padding : "0.05em" } }
111
110
className = { `btn btn-danger m-1` }
0 commit comments