Skip to content

Instantly share code, notes, and snippets.

@Prinzhorn Prinzhorn/upload.js
Created Nov 13, 2013

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

RubaXa commented Nov 13, 2013

FileAPI.version?

@Prinzhorn

This comment has been minimized.

Copy link
Owner Author

Prinzhorn commented Nov 13, 2013

1.2.6

@RubaXa

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner Author

Prinzhorn commented Nov 13, 2013

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

This comment has been minimized.

Copy link
Owner Author

Prinzhorn commented Nov 13, 2013

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

@RubaXa

This comment has been minimized.

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

This comment has been minimized.

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
You can’t perform that action at this time.