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'
    }

Thursday, February 7, 2013

Restart Nginx on OSX

Best to have them as bash aliases.

alias startnginx='sudo /usr/local/Cellar/nginx/1.2.4/sbin/nginx'
alias stopnginx='sudo killall nginx'
alias restartnginx='stopnginx; startnginx'

# If you need to know where's nginx bin
locate nginx