Ricardonacif / active_admin_jcrop

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

Ajax seems to process but image isn't updated (paperclip w/ S3) #14

Closed andymilk closed 9 years ago

andymilk commented 9 years ago

Here's what I see in console: Started PUT "/admin/pictures/64/jcropper" for 127.0.0.1 at 2015-11-10 21:20:48 -0500 Processing by Admin::PicturesController#jcropper as / Parameters: {"image_data"=>{"object_class"=>"picture", "object_id"=>"64", "crop_field"=>"image", "jcropper_url"=>"/admin/pictures/64/jcropper", "crop_x"=>"75", "crop_y"=>"48", "crop_w"=>"221", "crop_h"=>"100"}, "id"=>"64"} AdminUser Load (0.4ms) SELECT admin_users.* FROM admin_users WHERE admin_users.id = 1 ORDER BY admin_users.id ASC LIMIT 1 Picture Load (0.2ms) SELECT pictures.* FROM pictures WHERE pictures.id = 64 LIMIT 1 [paperclip] copying /images/picture/original/64/CTDVS7jUwAAca8a.jpg to local file /var/folders/t0/ds6v0q8s4m99bxmy97ndbvt40000gn/T/f87c165da351decd7f8d9905fe66bc9d20151110-26462-1gh9oj2.jpg WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.2 [AWS S3 200 0.18128 0 retries] get_object(:bucket_name=>"bnartunwind",:key=>"images/picture/original/64/CTDVS7jUwAAca8a.jpg")

Command :: file -b --mime '/var/folders/t0/ds6v0q8s4m99bxmy97ndbvt40000gn/T/f87c165da351decd7f8d9905fe66bc9d20151110-26462-a1p010.jpg' [paperclip] saving /images/picture/original/64/CTDVS7jUwAAca8a.jpg [AWS S3 200 0.123073 0 retries] put_object(:acl=>:public_read,:bucket_name=>"bnartunwind",:content_length=>37771,:content_type=>"image/jpeg",:data=>Paperclip::AttachmentAdapter: CTDVS7jUwAAca8a.jpg,:key=>"images/picture/original/64/CTDVS7jUwAAca8a.jpg")

(0.3ms) BEGIN SQL (0.5ms) UPDATE pictures SET image_file_name = 'CTDVS7jUwAAca8a.jpg', image_updated_at = '2015-11-11 02:20:48', updated_at = '2015-11-11 02:20:48' WHERE pictures.id = 64 (12.7ms) COMMIT Completed 200 OK in 644ms (Views: 0.5ms | ActiveRecord: 14.1ms)

Ricardonacif commented 9 years ago

For those who are using the latest paperclip versions, you might need to set an empty original style hash so the processor can work correctly (this is needed in the latest versions of Paperclip, not really sure why:

has_attached_file :attachment, :styles => {:original => {}}                 

Let me know if it worked.