Friday, February 15, 2013

Crop center and resize paperclip image attachment


  has_attached_file :profile_image,
    storage: :s3,
    s3_credentials: {
      bucket:            Settings.s3_bucket_name,
      access_key_id:     Settings.aws_access_key_id,
      secret_access_key: Settings.aws_secret_access_key
    },
    default_url: '/assets/default_profile_pic.png',
    styles: { square_50: '', square_100: '', square_193: '' },
    convert_options: {
      square_50: '-gravity center -resize 50x50^ -crop 50x50+0+0',
      square_100: '-gravity center -resize 100x100^ -crop 100x100+0+0',
      square_193: '-gravity center -resize 193x193^ -crop 193x193+0+0'
    }

No comments: