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

Same aspect ration for multiple images #528

Open
TwunTee opened this issue Jan 27, 2019 · 5 comments
Open

Same aspect ration for multiple images #528

TwunTee opened this issue Jan 27, 2019 · 5 comments
Assignees

Comments

@TwunTee
Copy link

TwunTee commented Jan 27, 2019

Is it possible to use free crop for the first image and then apply its aspect ratio to other images too. I am trying to do something similar to how instagram does. User uploads his images, first image aspect ratio is fetched and then it is applied to other images too, so that when using it in a carousel the size of the container can remain the same. I tried using onchange, but it is triggered after the user clicks on add, if there is a trigger to know when the user has selected the image that would be good too.

@optlsnd
Copy link
Contributor

optlsnd commented Jan 28, 2019

Hi @TwunTee

Can you tell me more about the workflow? Are you using a widget with the "multiple" mode enabled or a user uploads files one by one? What happens after uploading? If possible, share your code snippet so I can look into it.

@TwunTee
Copy link
Author

TwunTee commented Jan 30, 2019

Yes i am using the widget with multiple mode enabled. The workflow will be like the widget has multiple option set to true and a user uploads multiple images either one by one or select all the images in one go either way once multiple images are selected the aspect ratio should be changed from free to the aspect ratio of the first image so that aspect ratio is same for all the images.

Would be good if the preview is shown with the aspect ratio changed instead of mini images.

The problem I am facing is that when the user uploads multiple images and their aspect ratio is different then when they get displayed on the mobile, it looks weird with one image having a different height, gets cropped out or zoomed in.

// Angular example
                                <ngx-uploadcare-widget
                                                       [images-only]="true"
                                                       image-shrink="1024x1024 95%"
                                                       [multiple]="true"
                                                       tabindex="-1"
                                                       [crop]="true"
                                                       (on-change)="onChange($event, 'images')"
                                                       (on-upload-complete)="imageUploadHandler($event)"
                                                       public-key="{{uploadcareKey}}">
                                </ngx-uploadcare-widget>

@TwunTee
Copy link
Author

TwunTee commented Feb 9, 2019

@optlsnd Hi any updates on this. Was the explanation ok or do I need to give more info?

@TwunTee
Copy link
Author

TwunTee commented Apr 9, 2019

@optlsnd @Zmoki Any updates or suggested workaround for this issue.

@optlsnd
Copy link
Contributor

optlsnd commented Apr 9, 2019

@TwunTee I'm sorry for such a long delay with the reply. Technically, there's no way to update widget's crop settings on the run. However, if you define a specific aspect ratio in crop settings, it will be applied to all uploaded images automatically. You can add aspect ratio validation to pass images with a certain aspect ratio or orientation only. Hope that helps.

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

No branches or pull requests

2 participants