Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to update width and height of ngf-resize after file has been selected? #1117

Closed
vanbergcamp opened this issue Nov 3, 2015 · 7 comments

Comments

@vanbergcamp
Copy link

I would like to reduce quality of image before image upload. I tried to use 'ngf-resize' with quality set to 0.8. I used Upload.imageDimensions to get width and height of image and use it as parameter for ngf-resize ( as I don't want to change the dimension) . However, if I update the ngf-resize using this value, it is used only when another file has been selected. It does not work for the current file being selected. Is there a way to update them for the currently selected file?

@danialfarid
Copy link
Owner

Just set the quality on ngf-resize it should use the original size by default so no need for calling imgaeDimentions

@vanbergcamp
Copy link
Author

When I set quality as ngf-resize="{quality:0.8}" , I got following error.
"width and height are mandatory for ngf-resize".
I apologize if I am missing simple way to set the value.

@danialfarid
Copy link
Owner

Gonna fix it in the next version. But you probably want to resize the photo as well if you are reducing the quality.
For now use Upload.resize(file, width, height, quality).then(...) instead of ngf-resize and pass null for width and height

@vanbergcamp
Copy link
Author

Thank you danialfarid.

@MrAtheist
Copy link

@danialfarid, can you provide a more complete example where the image is first resized then being uploaded? I have tried ngf-resize but that's not working for me. Maybe what you're suggesting with Upload.resize(file, width, height, quality).then( ...what's passed here for the upload?) would do the trick.

@danialfarid
Copy link
Owner

.then(function(file) {Upload.upload({data: {file: file}})});

danialfarid pushed a commit that referenced this issue Nov 10, 2015
@danialfarid
Copy link
Owner

Fixed at version 10.0.0. You can just specify the quality.

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

No branches or pull requests

3 participants