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

width/height auto not supported? #1124

Closed
eduardoinnorway opened this issue Nov 7, 2015 · 4 comments
Closed

width/height auto not supported? #1124

eduardoinnorway opened this issue Nov 7, 2015 · 4 comments

Comments

@eduardoinnorway
Copy link

Well, I tried this out today and it was really easy to get started. But I can't see how to do width/height:auto, because in almost all cases you never resize an image to fixed sizes on both width and height because then you are probably ending up with a messed up picture, you use one as the reference and the other one is "auto", you never know what ratio the users will have.
This would be very appreciated:

ngf-resize="{width: 100, height: 'auto'}" or just ngf-resize="{width: 100}" and auto as default if width or height is not given.

@danialfarid
Copy link
Owner

It would always keep the aspect ratio of the image so the image will not be distorted. So you can set the width and height so it would fit the picture in that box adding empty borders if necessary.

@eduardoinnorway
Copy link
Author

I done a ton of picture related projects and they usuallly want a fixed size in the wrapper, so what you do because uploaded images all have different sizes is that you go for widh or height as the determinator and you let the not fitting part, to just be invisible outside that box. So you will need "auto" feature, I usually program this directly before passing down to image-magic. But I would prefer to start to us ng-file-upload with auto supported.

Don't get me wrong, I am not beeing negative on your project, but width or height auto, is a common wanted feature in what you have.

Why not something like this in the "resize" function:
if(width === 'auto') {
width = Math.round((height/imageElement.height) * imageElement.width);
}
And for height same method with the corresponding right data.

@danialfarid
Copy link
Owner

What you are describing here is doable by setting a large value to either width or height to make them auto.

@danialfarid
Copy link
Owner

Fixed at 10.0.0, you can leave any of the width and height empty for the same effect.

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

No branches or pull requests

2 participants