You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
node_modules/promise-nodeify/index.js:35
later(() => { throw err; });
^
Error: Image could not be decoded (HTTP 400/Decode error)
at new ClientError (../node_modules/tinify/lib/tinify/Error.js:36:1)
at Function.create (../node_modules/tinify/lib/tinify/Error.js:31:12)
at IncomingMessage.response.on (../node_modules/tinify/lib/tinify/Client.js:89:35)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
Using the aws-sdk the same 'buf' is working well so I don't know what to think...
The text was updated successfully, but these errors were encountered:
The error that you're getting is caused by not providing proper binary image data to the Tinify library.
In your case, probably something is going wrong posting the base64 encoded image data to the server. For example, a base64 encoded string can include spaces, which need to be properly url encoded/decoded when you're not using standard multipart/form-data and processing/posting it yourself with custom code.
The code that you're using to convert the base64 encoded image data to binary data on the server is certainly correct.
Some examples to illustrate that compressing images with a buffer works:
Hello!
I've been trying to tinify a picture coming from the file API. While this works:
The following doesn't and I can't wrap my head around:
Server side
Client side
Full log
Using the aws-sdk the same 'buf' is working well so I don't know what to think...
The text was updated successfully, but these errors were encountered: