Skip to content

Instantly share code, notes, and snippets.

@Prinzhorn
Created November 13, 2013 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Prinzhorn/7446018 to your computer and use it in GitHub Desktop.
Save Prinzhorn/7446018 to your computer and use it in GitHub Desktop.
FileAPI upload
//Not working:
FileAPI.upload({
url: '/upload',
files: {
image: FileAPI.Image(file).resize(800, 800, 'min')
}
});
//Working fine:
FileAPI.upload({
url: '/upload',
files: {
image: file
}
});
@RubaXa
Copy link

RubaXa commented Nov 13, 2013

FileAPI.version?

@Prinzhorn
Copy link
Author

1.2.6

@RubaXa
Copy link

RubaXa commented Nov 13, 2013

1.2.6 — not supported FileAPI.Image uploading, only 2+, but:

FileAPI.upload({
    url: '/upload',
    files: {
        image: file
    },
    imageTransform: {
        width: 800,
        height: 800,
        type: 'min'
    }
});

@Prinzhorn
Copy link
Author

Great, works!

The documentation about imageTransform doesn't mention all these options.

Also the changelog of 2.0.0 is lacking some important details then.

@Prinzhorn
Copy link
Author

Also: does imageTransform support auto orientation? Because the exif is destroyed, I can't rotate it server side anymore.

@RubaXa
Copy link

RubaXa commented Nov 13, 2013

Yes, you're right. I try to improve documentation, but time is against me:]

https://github.com/mailru/FileAPI/tree/dev#imagetransformobject

@RubaXa
Copy link

RubaXa commented Nov 13, 2013

So or imageAutoOrientation: true:

FileAPI.upload({
    url: '/upload',
    files: { image: file },
    imageTransform: {
        width: 800,
        height: 800,
        type: 'min',
        rotate: 'auto' // so
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment