Foliotek / Croppie

A Javascript Image Cropper
http://foliotek.github.io/Croppie
MIT License
2.55k stars 886 forks source link

Canvas images are displayed large #794

Open K-Massy opened 7 months ago

K-Massy commented 7 months ago

Thank you for helping.

I implemented the code with reference to the official documentation,

img_url = $('#imag_thumb').children('img').attr('src');  // get image url

var el = document.getElementById('img-crop');
var resize = new Croppie(el, {
    viewport: { width: 100, height: 100 },
    boundary: { width: 300, height: 300 },
    showZoomer: false,
    enableResize: true,
    enableOrientation: true,
    mouseWheelZoom: 'ctrl'
});
resize.bind({
    url: img_url,
});

The image size displayed on canvas is not adjusted like in the official demo, and is displayed at the same image size.

How can I adjust the image size like in the official demo?

gabyokal commented 2 months ago

Hi! Were you able to solve the problem?

JorensM commented 1 week ago

Make sure your page has <script/> tags for jQuery and croppie.js