-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
How to scale up cropper ? #186
Comments
This is an edge case that is not properly handled for narrow vertical images. Are you using the latest version? |
I'm using 3.2.1 version |
Could you please provide an example on Codesandbox so that I better understand what's going on? |
Yeah sure, https://codesandbox.io/s/react-easy-crop-demo-with-cropped-output-forked-kl5gu?file=/src/index.js What i want is this now the crop area is small id' like to keep same crop size 60x120 but just to scale it up example : |
I think you could use a different approach: use |
Oh it make sense now i tried that but i use different aspect and that make picture go very wide,
|
I think having a The original goal of this component is to be responsive and having a hard-coded |
Definitely agree, when i was start using cropSize i was hoping i will get image cropped to that size, as u can see i edited getCroppedImage to make it export image with that size. Maybe in future add new function that will do just this, cause having cropSize and not crop it to that dimensions is weird. I know that package is made for responsiveness but i think people would also use this function a lot ! |
The thing is that the actual cropping logic is not built in the library. It's only provided in the demos as an example. It's the developer responsibility to implement any logic in there. |
Yep, but when u start with package it's not written anywhere, "Basic Usage" in readme is also without custom logic for exporting image and that also confuses people on some way as they think this it will work out of box, its just little bit confusing when u starting to catch up all what is happening. But beside that package is very useful keep up good work hope it will be better and better ! |
I think its still good feature, there are a use case when the crop size is determined and its really convenient feature to have in that case |
@laptopmutia are you talking about the function to output the cropped image? |
@arminsalcin I'm facing the same features as you, so what have you finally done? |
@tiavina-mika what is your issue? |
Hey @ValentinH , maybe you can help me, i am having a similar issue. I want the image crop frame to always be the same size, but it seems the size changes depending on the ratio of the image. Please see the video recording below.
|
The |
Hi, @ValentinH |
I'm not sure to understand what you want and why the solution in my last comment doesn't work for your use case. Could you detail a little bit, with some visuals maybe. |
Hi @ValentinH |
What objectFit property did you use? Did you try to give the cropped the same ratio as your parent div? |
This is what I have given ObjectFit={1} |
This is not a valid value, please have a look to the documentation and the objectFit demo. |
I got the solution for this problem by get the uploaded image size and set objectFit attribute in
|
I wonder if there is this option automatically in the library from the previous comment |
What do you mean? |
I meant
as the cropper already deals with image size and for us to don't need to load then to get its size and pass the proper objectFit, should be nice if we could see an option like that in the cropper iself, like |
This is a great idea. I would call it "auto-cover". Would you like to do a PR? 🙂 |
Sure, I'll open in next week. |
As far as I know, no work was started on this so feel free to create a PR if you want 😎 |
Hi @ValentinH ! Could you help me with this? I am trying to crop an image to an exact size (let say 800 x 400 px). I can't use "aspect", instead I used the cropSize parameter and passed "{width: 800, height: 400}" but it's not working. When I check the croppedAreaPixels in onCropComplete method it changes depending on the image real size. I thought cropSize would fix the size at this stage. I don't want to set the width and height in getCroppedImg logic because it ends up cutting an extra piece of the image. What should I do? |
I just found my answer here: #176 . However, It would be better if the cropper could fit the real cropsize |
Has the function of cutting fixed sizes been provided? What should I do? |
You should try the objectFit prop and set it to "cover" |
I want full width base crop and height will be auto |
Hello to all, i want to somehow scale up the cropper view , now is like this i have crop area of {60px x 120px}. I wanto to have it bigger so i can better see crop area.
The text was updated successfully, but these errors were encountered: