carrierwave-crop icon indicating copy to clipboard operation
carrierwave-crop copied to clipboard

Add "only version(s)" and data html attributes for javascript

Open sunchess opened this issue 8 years ago • 0 comments

You can set versions where need to crop.

    #Version for ipad
    version :ipad_main do
      process crop: :image
    end

    #Set crop versions for example in _ipad.html.erb partial
    <%= f.cropbox :avatar, only: :ipad_main %>

    #Version for android
    version :android_main do
      process crop: :image
    end

    #Set crop versions for example in _andtoid.html.erb partial
    <%= f.cropbox :avatar, only: :android_main %>


    #or both
    <%= f.cropbox :avatar, only: [:ipad_main, :android_main] %>

If you need to html data attributes you can set data option

    <%= f.cropbox :avatar, data: {width: 1024, height: 768} %>

    #and you can use it in javascript

sunchess avatar Sep 07 '15 14:09 sunchess