Only allow JPG, PNG and GIF for profile pictures, and only allow JPG and PNG for profile headers

This commit is contained in:
Yuki 2015-05-10 10:08:06 +05:30
parent 4c6b009d23
commit 94e2dbc5ad
1 changed files with 2 additions and 2 deletions

View File

@ -48,12 +48,12 @@ class User < ActiveRecord::Base
has_attached_file :profile_picture, styles: { large: "500x500#", medium: "256x256#", small: "80x80#" },
default_url: "/images/:style/no_avatar.png", use_timestamp: false,
processors: [:cropper]
validates_attachment_content_type :profile_picture, :content_type => /\Aimage\/.*\Z/
validates_attachment_content_type :profile_picture, :content_type => /\Aimage\/(png|jpe?g|gif)\Z/
has_attached_file :profile_header, styles: { web: "1500x350#", mobile: "450x105#", retina: "900x210#" },
default_url: '/images/header/:style/no_header.jpg', use_timestamp: false,
processors: [:cropper]
validates_attachment_content_type :profile_header, :content_type => /\Aimage\/.*\Z/
validates_attachment_content_type :profile_header, :content_type => /\Aimage\/(png|jpe?g)\Z/
process_in_background :profile_picture
process_in_background :profile_header