supnate / icropper

Javascript Image Cropper
MIT License
76 stars 20 forks source link

Setting imagePreview dimensions #7

Closed priyesh-diukar closed 6 years ago

priyesh-diukar commented 6 years ago

Hello,

Is there an api to set imagePreview dimensions? The example demo.html shows only small preview. I want to show the same effect on a full screen size. How can i achieve this? Also can I set the cropping aspect ration to 16:9 ?

Any help will be highly appreciated. Thank you :)

supnate commented 6 years ago

You should be able to use ratio parameter.

var ic = new ICropper(
    'cropperContainer'    //Container id
    ,{
        ratio: 16/9    //Set aspect ratio of the cropping area
        ,image: 'demo.png'
        ,preview: [
                'previewSmall'  //Preview node id
        ]
    }
);
priyesh-diukar commented 6 years ago

Supnate. Thank you for your quick reply. I see the rendered cropping region is always centered inside the cropper div. Can i set Left, Top, Width, Height property for my preview to render the initial cropping region other than center?

supnate commented 6 years ago

Sorry, there's not such configuration yet...

priyesh-diukar commented 6 years ago

Okay. I will figure the rest out. Thanks once again for your help.

supnate commented 6 years ago

No problem.