jcrop裁剪许多图像获取正被裁剪的图像的id

时间:2017-04-11 21:55:08

标签: javascript php image jcrop

我有一个循环,生成包含图像的面板。

<div class="panel edited_picture"'>
    <div class="panel-body">
        <h3 class="title-hero">
            Zdjęcie #{{$picture->id}}
        </h3>
        <div class="example-box-wrapper">
            <img picture_id='{{$picture->id}}  src="{{$picture->get_full_path()}}" class="jcrop-handler" alt="Example image">
        </div>
    </div>
</div>

我希望能够读取正在裁剪的图像ID。优选地通过读取属性值。

以下代码不起作用:

 $('.jcrop-handler').Jcrop({
    onChange: showCoords,
    onSelect: showCoords,
    onRelease: clearCoords
}, function() {
    jcrop_api = this;

});


    function showCoords(c) {

       id = $(this).attr('picture_id');
alert(id);
}

0 个答案:

没有答案