advanced-cropper / vue-advanced-cropper

The advanced vue cropper library that gives you opportunity to create your own croppers suited for any website design
https://advanced-cropper.github.io/vue-advanced-cropper/
Other
931 stars 130 forks source link

disable zoom? #175

Closed hi-reeve closed 2 years ago

hi-reeve commented 2 years ago

is there any way to set the default zoom and prevent the user to zoom the image? can't find anything on the docs

Norserium commented 2 years ago

@zynth17, zoom is actually just the high level abstraction of changing the visible area.

So, you can set the default visible area to get the default zoom.

To prevent the possibility to zoom image by an user you can block image resize events by setting :resize-image="false".

There is the example.

But I'm curious, what is the use case for it? I hardly can imagine why do you need it.

hi-reeve commented 2 years ago

@zynth17, zoom is actually just the high level abstraction of changing the visible area.

So, you can set the default visible area to get the default zoom.

To prevent the possibility to zoom image by an user you can block image resize events by setting :resize-image="false".

There is the example.

But I'm curious, what is the use case for it? I hardly can imagine why do you need it.

thanks! i will try it later. the case is, i want the user to upload an image, without restricted dimension. but i need to set the picture to have max width to make all the image have the same width while they are cropping and also the cropper itself has a fixed size of 200x200 px so i dont want the user to zoom on the picture. the default zoom is for making the image visible in all area because of the zoom prevention

Norserium commented 2 years ago

@zynth17, I'm not sure, but did you consider for your use-case the result resizing?

hi-reeve commented 2 years ago

@zynth17, I'm not sure, but did you consider for your use-case the result resizing?

have check it but havent consider on using it. since the result i need is a fixed size of 200x200. isnt it better to use the fixed stencil size?

Norserium commented 2 years ago

@zynth17, consider the following use-case.

An user uploads the photo (683px / 1024px). image

He want to choice the selected area on the left image, but if you limit the choice to size 200x200 he will be able to select the area only with the same size as the size of the area one on the right image.

It seems, that you shouldn't limit the size of the cropped area, you should scale the result to the needed size. But it's up to you, of course.

hi-reeve commented 2 years ago

@zynth17, consider the following use-case.

An user uploads the photo (683px / 1024px).

image

He want to choice the selected area on the left image, but if you limit the choice to size 200x200 he will be able to select the area like on the right image.

It seems, that you shouldn't limit the size of the cropped area, you should scale the result to the needed size. But it's up to you, of course.

thanks! i will consider this. one more question. is there any way to make the image have max height? i try to wrapping the cropper element on a div and giving the div a max height but the image still overflowing the parent div.

Norserium commented 2 years ago

@zynth17, I need more information (the codesandbox would be perfect), but try to set the max height for the cropper itself.

hi-reeve commented 2 years ago

@zynth17, I need more information (the codesandbox would be perfect), but try to set the max height for the cropper itself.

hey thankyou for the help! i will close this issues since this is already done now.

Norserium commented 2 years ago

@zynth17, you are welcome!