Get started with cropit CDN

MIT licensed

Cropit is a library for image cropping and resizing in the browser.

Tags:
  • crop
  • zoom
  • image editor

Stable version

Copied!

How to start using cropit CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with cropit CDN - cdnhub.io</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropit/0.5.1/cropit.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.cdnhub.io/cropit/0.5.1/jquery.cropit.min.js"></script>
</head>
<body>
    <div style="width: 300px; height: 300px; border: 1px solid #ccc;">
        <img id="image" src="path/to/your/image.jpg" alt="Image to be cropped">
    </div>
    <button id="crop-button">Crop Image</button>

    <script>
        $(document).ready(function() {
            $('#crop-button').click(function() {
                $('#image').cropit();

                $('#image').on('cropit.imageCropped', function(event, data) {
                    // Get the cropped image data
                    var croppedImage = data.result;

                    // Do something with the cropped image data
                    console.log(croppedImage);
                });
            });
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!

All versions