scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 307 forks source link

imageState not working #261

Open codebeginer opened 6 years ago

codebeginer commented 6 years ago

I have tried this option in the demo example of the file but still this does't work. `<!DOCTYPE html>

cropit
Resize image
$form.serialize() =

`

FelixLeChat commented 6 years ago

Try : $('.image-editor').cropit('imageSrc', 'k.jpg'); instead of $('.image-editor').cropit({'imageState':'k.jpg'});

sircEUNHO commented 6 years ago

I also have this problem I tried

$('.image-editor').cropit({
    exportZoom: 1.25,
    imageBackground: true,
    imageBackgroundBorderWidth: 20,
    width: 400,
    height: 400,
    allowDragNDrop: false,
    imageState: {
        src: 'http://localhost:3000/magisgit/printright/public/storage/projects/240/AoohK1CbmMLuKYaP8lfSsOPBBdRhbvOJB0bQfHY1.jpeg',
    },
    onZoomChange: (() => {
        alert('test');
    }),
    onOffsetChange: (() => {
        alert('two');
    }),
});

but it doesnt work, so i tried:

$('.image-editor').cropit('imageSrc', 'http://localhost:3000/magisgit/printright/public/storage/projects/240/AoohK1CbmMLuKYaP8lfSsOPBBdRhbvOJB0bQfHY1.jpeg');

my html mark up is this:

<div class="image-editor">
    <div class="cropit-preview"></div>
    <br>
    <br>
    <center>
        <span class="fa fa-search-minus zoom-ft"></span>
        <input type="range" class="cropit-image-zoom-input">
        <span class="fa fa-search-plus zoom-ft"></span>
    </center>
    <br>
    <div class="text-center">
        <button class="btn register">
            <span v-text="isCropping">Crop Photo</span>
        </button>
    </div>
</div>

but this still didn't work? what is the problem of my code?

webfarmer commented 2 years ago

anyone found a solution yet. I'm getting the same problem.