Coder Social home page Coder Social logo

Comments (13)

Norserium avatar Norserium commented on May 21, 2024 1

@CalvinJamesHeath, if you use the canvas to get the cropped image, you can use the native approach:

const canvas = cropper.getCanvas({
        height: 600,
        width: 600,
})

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

stencilProps={{
grid: true,
movable: cropperEnabled,
resizable: cropperEnabled,
lines: cropperEnabled,
handlers: cropperEnabled,
rotatable: cropperEnabled,
overlayClassName: cn(
'image-editor__cropper-overlay',
!cropperEnabled && 'image-editor__cropper-overlay--faded',
),
}}

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

So at advanced cropper it says : To customize the default stencils you should pass props to stencilProps props as object (read link in detail). However the link is broken.

from react-advanced-cropper.

Norserium avatar Norserium commented on May 21, 2024

@CalvinJamesHeath, do you want to get the following result?

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

I'm attempting to accomplish the following with the CircleStencil or any other tool you deem appropriate.
What I want to achieve:
Screenshot 2024-01-20 at 11 09 06 PM

What I get with the default configuration:
Screenshot 2024-01-20 at 11 08 54 PM

Also with the desired oval cropped image, I also want to show the image preview besides the cropper.

Thank you @Norserium

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

And the desired cropper should not strech all the way to the circle stencil, but only to the width of the oval stencil

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

// // ellipse / oval css .advanced-cropper-circle-stencil__draggable-area, .advanced-cropper-circle-stencil__overlay, .advanced-cropper-circle-stencil__preview, .advanced-cropper-circle-stencil__grid { position: relative; height: 100%; width: 90% !important; }; What I targeted for the example

from react-advanced-cropper.

Norserium avatar Norserium commented on May 21, 2024

@CalvinJamesHeath, I don't get you. The circle stencil limits aspect ratio to 1/1, so you should create your own stencil or customize the rectangle stencil.

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

Well then I guess my question is how to do that. Can you pass a default aspect ratio that can expand or shrink but always look like an oval? I opened another issue before because the "Create your own Custom Stencil section link" was invalid.

Thanks again.

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

So I added stencilProps={{aspectRatio: 4 / 5, }} for an ellipse/oval aspect.
How do I get back the preview lines or oval shape inside the handler? Because the previewClassName only shows if Im using the CircleStencil.
Screenshot 2024-01-21 at 12 05 49 PM

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

The preview className works perfectly, I used:
.preview { border: dashed 2px rgba(255, 255, 255, 0.764); border-radius: 50%; }

Thank you.

from react-advanced-cropper.

Norserium avatar Norserium commented on May 21, 2024

@CalvinJamesHeath, you are welcome!

from react-advanced-cropper.

CalvinJamesHeath avatar CalvinJamesHeath commented on May 21, 2024

I have a question about image cropping. When I load an image into the cropper, it has its unique width and height. However, when I save the cropped image and resize it to be 600x600 in the backend, the resulting image dimensions differ from the initial cropped dimensions.

Is there a way to set a predetermined width and height for any image added to ensure consistency in the final cropped image?

from react-advanced-cropper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.