parse-image icon indicating copy to clipboard operation
parse-image copied to clipboard

no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.

Open mchun opened this issue 8 years ago • 18 comments

Thanks for creating this repo. But I wonder if any delegate of imagemagick has to be installed? I encountered the caption error when executing setData.

Parse.Cloud.httpRequest({ url: url }).then(function(response) {
    // Create an Image from the data.
    var image = new Image();
    return image.setData(response.buffer);
);

mchun avatar Feb 26 '16 09:02 mchun

@mchun what platform/system are you running on?

flovilmart avatar Feb 26 '16 13:02 flovilmart

mac osx 10.10.5 when I do "convert -list configure" It contains the following, I have no idea what went wrong and currently using jimp instead. DELEGATES bzlib mpeg freetype jng jpeg lzma png tiff webp xml zlib

mchun avatar Feb 26 '16 17:02 mchun

I'm on 10.11.3 and that works like a breeze, on travis the tests passes too.. that's really odd. Seems a mis installation of the couple gm/imagemagick

flovilmart avatar Feb 26 '16 17:02 flovilmart

This is encoding problem. Parse.Cloud.httpRequest is using request.

encoding - Encoding to be used on setEncoding of response data. If null, the body is returned as a Buffer. Anything else (including the default value of undefined) will be passed as the encoding parameter to toString() (meaning this is effectively utf8 by default). (Note: if you expect binary data, you should set encoding: null.)

Set encoding to null can solve the problem for me.

Parse.Cloud.httpRequest({ url: url, encoding: null}).then(function(response) {
    // Create an Image from the data.
    var image = new Image();
    return image.setData(response.buffer);
);

carmenlau avatar Mar 08 '16 04:03 carmenlau

Good catch! Do you have time for a Pr?

flovilmart avatar Mar 08 '16 04:03 flovilmart

Saw your PR in parse-server for this issues. Thanks a lot and appreciate for your work!

carmenlau avatar Mar 08 '16 11:03 carmenlau

Hi @flovilmart, Thanks for doing this. I am getting the same error too when trying to download an image from a url using httpRequest. I even tried using encoding = null but still doesn't work. Can you please let me know how I should work around this error.

tsanthosh avatar Mar 14 '16 06:03 tsanthosh

can you try without using Parse.Cloud.httpRequest but a simple http request manager and see if it works passing the response buffer to ParseImage

flovilmart avatar Apr 01 '16 14:04 flovilmart

Ive tried two different request clients here and am still getting the same error. Is this something that is occuring across all file adapters or could it be provider specific?

mcclaskiem avatar Apr 06 '16 17:04 mcclaskiem

I'm not sure. where is it deployed? heroku?

flovilmart avatar Apr 06 '16 17:04 flovilmart

Im running it locally on 10.10.5

mcclaskiem avatar Apr 06 '16 17:04 mcclaskiem

uhm, never had that issue on mac...

flovilmart avatar Apr 06 '16 17:04 flovilmart

both graphmagick and imagemagick are installed via homebrew, is there something I can check to confirm with confirm -list configure

mcclaskiem avatar Apr 06 '16 17:04 mcclaskiem

Can you try cloning the repo and run the tests? With npm run tests?

flovilmart avatar Apr 06 '16 17:04 flovilmart

Got 8 passing here, must be something with the response that I am passing.

mcclaskiem avatar Apr 06 '16 17:04 mcclaskiem

yup that's most likely, make sure that's a proper buffer with an image in it :)

flovilmart avatar Apr 06 '16 17:04 flovilmart

Where do you suggest posting to verify a FileAdapter? I have one written for RackSpace but would like to make sure its conformant to parse-server

mcclaskiem avatar Apr 06 '16 17:04 mcclaskiem

try locally with your code to save the buffer as a file.

flovilmart avatar Apr 06 '16 17:04 flovilmart