Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image uploaded on S3 but not cropped #14

Open
charlesdg opened this issue Feb 21, 2014 · 6 comments
Open

Image uploaded on S3 but not cropped #14

charlesdg opened this issue Feb 21, 2014 · 6 comments

Comments

@charlesdg
Copy link

Hello,

I'm using your gem with paperclip 3.5 on a rails 4 application and all is going fine but the picture saved under S3 are not cropped.

Here's the log. What I'm missing?


Processing by ImgProcessingController#crop_edit_agency as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"RCvVsN3am+OIFMfYXEAub9h1ZIEMs/p9Ib1rc4JkNJM=", "edit_agency"=>{"cover_pic_original_w"=>"2048.0", "cover_pic_original_h"=>"1369.0", "cover_pic_box_w"=>"700", "cover_pic_crop_x"=>"0", "cover_pic_crop_y"=>"263", "cover_pic_crop_w"=>"2048", "cover_pic_crop_h"=>"701", "cover_pic_aspect"=>"2.9197080291970803"}, "commit"=>"Submit cropped cover picture", "id"=>"62"}
  User Load (1.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 10 ORDER BY "users"."id" ASC LIMIT 1
  LinkedinProfile Load (0.5ms)  SELECT "linkedin_profiles".* FROM "linkedin_profiles" WHERE "linkedin_profiles"."user_id" = $1 ORDER BY "linkedin_profiles"."id" ASC LIMIT 1  [["user_id", 10]]
  EditAgency Load (0.8ms)  SELECT "edit_agencies".* FROM "edit_agencies" WHERE "edit_agencies"."id" = $1 LIMIT 1  [["id", "62"]]
   (0.3ms)  BEGIN
[paperclip] copying /edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg to local file /var/folders/kd/hfx1g5ts4354ctfgc_x7l93m0000gn/T/1071315_10153070566640187_1979155193_o20140221-7855-zs5rj9.jpg
[AWS S3 200 0.763641 0 retries] get_object(:bucket_name=>"magicagencies-test",:key=>"edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg")  

[AWS S3 200 0.043105 0 retries] head_object(:bucket_name=>"magicagencies-test",:key=>"edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg")  

[paperclip] deleting /edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg
[AWS S3 204 0.049076 0 retries] delete_object(:bucket_name=>"magicagencies-test",:key=>"edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg")  

[paperclip] saving /edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg
[AWS S3 200 0.185554 0 retries] put_object(:acl=>:public_read,:bucket_name=>"magicagencies-test",:content_length=>221684,:content_type=>"image/jpeg",:data=>Paperclip::AttachmentAdapter: 1071315_10153070566640187_1979155193_o.jpg,:key=>"edit_agencies/cover_pics/000/000/062/original/1071315_10153070566640187_1979155193_o.jpg")  
@macowie
Copy link

macowie commented Feb 27, 2014

I'm having the same issue

@macowie
Copy link

macowie commented Feb 27, 2014

@charlesdg I found the issue (for me at least), Paperclip doesn't run processors if no styles are defined, so I just added an empty :cropped style, like so:

has_attached_file :key_image, styles: { :cropped => '' }

@charlesdg
Copy link
Author

great @macowie ! It's perfect!

@brodyhoskins
Copy link

I'm still having the issue, even while using has_attached_file:

  has_attached_file :image, {
    styles: {
      thumb: ['300x200']
    },
    convert_options: {
      thumb: '-quality 80 -interlace Plane'
    }
  }

@rsantamaria
Copy link
Owner

Thanks @macowie, you're right.
Taken from Paperclip README: "NOTE: Because processors operate by turning the original attachment into the styles, no processors will be run if there are no styles defined."

@atstockland
Copy link

I had a similar problem...I think mine was related to using the process_in_background method. I removed process_in_background, and things are working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants