Enlcxx / angular2-resizing-cropping-image

Resize, rotate and crop images(cropper) for Angular 8
https://alyle.io/components/image-cropper
32 stars 6 forks source link

Round Cropper #19

Closed ruthansah closed 5 years ago

ruthansah commented 6 years ago

Thank you for this wonderful plugin. Is there a way to configure the cropper to be round rather than square?

Enlcxx commented 5 years ago

use css, border-radius: 50%;

sajidgangat commented 5 years ago

Any updates on this? How can I display round cropper instead of the default square? Where should I place border-radius: 50%;? @Enlcxx @alyleui

Enlcxx commented 5 years ago

Hi @sajidgangat sorry for the delay.

Add border-radius: 50%; to the result in your stylesheet, but if you want to edit the cropping area, you can add variables to theme.

e.g.

export class GlobalVariables implements PartialThemeVariables {
  ...
  ...
  imgCropper = {
    root: {
      '& {area}, & {area}::after': {
        borderRadius: '50%'
      }
    }
  };
}

result:

img

Obviously this will not make the result rounded, so do not forget to add the styles to the result.