Closed rafalolszewski94 closed 2 years ago
@rafalolszewski94, if I understood you correctly, I see a plenty of different ways to do what you need.
For example, I can offer you the CSS-only solution supported by the most browsers. You can make it even simpler by using of aspect-ratio
property if you may use it.
Notice, you can select the area around of the image, but try to resize image. It's perfectly normal behavior, but I should warn you about it.
@rafalolszewski94, any news?
@rafalolszewski94, any news?
@rafalolszewski94, any news?
Sorry for late reply, everything works with 'absolute' way. Didn't really understand how aspect ratio could work here or what the layout should look like with it.
@rafalolszewski94, first of all, the solution is not specific for the cropper. The cropper just fills the available place. The trick is the available place preserves the aspect ratio.
To make that you can use aspect-ratio
property or the old trick. I used the last one. You can find its explanation in this nice answer, also you can find the other solutions below.
@rafalolszewski94, is your issue solved?
@rafalolszewski94, any news?
@rafalolszewski94, any news?
Resolved with your CSS solution plus I changed some settings afterwards anyway.
As a recommendation I would promote most the twitter example, because I believe it's closest to most used world-wide cropper behaviour.
@rafalolszewski94,I will rewrite the documentation in the future to make it similar to react-advanced-cropper
. So an user will be able to see the most popular cropper solutions on the main page. The link to the source code is available in the info section.
What I'm trying and failing to achieve is a cropper that's always square to put it as simple as possible.
Explaining more, via examples; if you have horizontal image, I would like to add empty white space which can be also in the area of the cropped image to make the image square
Current behaviour:![image](https://user-images.githubusercontent.com/37925892/151139745-5a216036-2cd5-48ff-82b9-d32b2ec5ada4.png)
As you can see, it's completely horizontal. What I want is to take dynamically highest number of width or height of the image and make the other value the same (so it's square always)
What I (kind of) want to achieve:![image](https://user-images.githubusercontent.com/37925892/151140284-7268c642-55bc-4bee-93ef-6a06e51f6257.png)
Gray area should be also available to the cropper (it is just height CSS class on the cropper)