Ricardonacif / active_admin_jcrop

DEPRECATED - Jcrop plugin for ActiveAdmin, enables cropping on image fields when editing
MIT License
55 stars 35 forks source link

jcrop with s3 is not working #19

Closed puneetpandey closed 6 years ago

puneetpandey commented 7 years ago

Hi, I am using carrierwave with s3 and trying to crop image but image never gets cropped. Below is my code: jcropable form do |f| f.semantic_errors *f.object.errors.keys f.inputs 'Group' do f.input :name f.input :logo_url, as: :jcropable, hint: image_tag(f.object.logo_url.url(:thumb)) end f.actions end model group.rb mount_uploader :logo_url, ActiveAdminLogoUploader

and inside active_admin_logo_uploader.rb ` class ActiveAdminLogoUploader < CarrierWave::Uploader::Base

include CarrierWave::MiniMagick

include CarrierWave::RMagick include ActiveAdminJcrop::AssetEngine::CarrierWave

if Rails.env.test? storage :file else storage :fog

storage :file

end

def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end

version :thumb do process :active_admin_crop process resize_to_fill: [256, 144] end end ` can you help?

bctoh commented 7 years ago

same issue with active admin jcrop and cloudinary. any answers on this?

Ricardonacif commented 7 years ago

Can you please post the version of gems like carrierwave, active admin and Rails? I'm really busy this week but I'll take a look in the weekend ok?

bctoh commented 7 years ago

Cheers for the reply and for making time this weekend, really appreciate it. Version of gems below:

Ricardonacif commented 7 years ago

Great I'll let you know @bctoh

bctoh commented 7 years ago

Any luck @Ricardonacif?

Ricardonacif commented 7 years ago

@bctoh looking at it now

Ricardonacif commented 7 years ago

@bctoh I just tested it using the gem versions you said. All good on my end. I did a demo repo with rails 5 so you can see if you're doing it right: https://github.com/Ricardonacif/active-admin-jcrop-rails-5-demo

Also, I recorded a video to highlight some important code parts: https://www.youtube.com/watch?v=zlnbAivTqDM&feature=youtu.be

Let me know if it worked for you.

valdemarua commented 7 years ago

@bctoh @puneetpandey do you override filename method in the uploader file?

bctoh commented 7 years ago

@Ricardonacif thank you so much for your time. am able to make it work when editing a project model but the crop function doesn't appear when creating a new project model so when I upload an image for the first time, I'm unable to crop it there. Not sure if you experience the same thing?

@valdemarua managed to get it to crop eventually. now it's just a UX problem. if it doesn't work for some reason, I'll explore your suggestion 🍻