Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

feat(service): add 'keep aspect ratio' option #7

Merged
merged 1 commit into from Nov 8, 2017

Conversation

bartholomej
Copy link
Contributor

@bartholomej bartholomej commented Nov 8, 2017

Keep Aspect Ratio

Usage

When keepAspectRatio is true then width + height parameters
become maxWidth + maxHeight parameters

Just add true as 4th parameter. It is optional and default value is false => without breaking changes.

Example

let newWidth = 2048;
let newHeight = 2048;
let keepAspectRatio = true;

this.ng2PicaService.resize([someFile], newWidth, newHeight, keepAspectRatio).subscribe((result)=>{
  //all good, result is a file
  console.info(result);
}, error =>{
  //something went wrong 
  console.error(error);
});

Temporary dist example

If you wanna try it right now, you can install it like this (temporary solution):
Just add to you package.json
"ng2-pica": "git+https://github.com/bartholomej/ng2-pica.git#keep-aspect-ratio"

Related issue

#4

When 'keepAspectRatio' is provided then width + height parameters
become maxWidth + maxHeight parameters
@bergben bergben merged commit 8f29ffd into bergben:master Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants