Carrierwave crop specific version

前端 未结 3 2080
被撕碎了的回忆
被撕碎了的回忆 2021-01-31 12:47

I am working on the ability to crop images using carrierwave and Jcrop. Its a combination of Railscasts episode 182 and 253. I have cropping working but it crops the original.

3条回答
  •  佛祖请我去吃肉
    2021-01-31 13:40

    If I correctly understand the problem more simple way is to send trueSize option to the Jcrop.

    <% geo = @item.image_geometry %>
    $('#cropbox').Jcrop({boxWidth:656,boxHeight:350,onChange:update_crop,onSelect: update_crop,aspectRatio:656/350,trueSize:[<%= "#{geo[0]}, #{geo[1]}"%>]});
    

提交回复
热议问题