ruby on rails 4 - Paper Clip is not saving thumbnails -
i have following code in model:
has_attached_file :avatar, path: ':class/:attachment/:id/:style/:basename.:extension', :styles=> { :original => "500x500", :small => "200x200" }, default_url: "icons/user.png"
i have installed imagemagick.
which convert /usr/bin/convert
in development.rb
paperclip.options[:command_path] = %w(/usr/local/bin/ /usr/bin/)
i have tried following:
paperclip.options[:command_path] = "/usr/bin/"
but when try upload picture saves original file. message log is:
[paperclip] saving user_profiles/avatars/53/original/2015-06-08-153213.jpg
what i'm missing?
in model can add below code. don't need worry size specified in code, can change size need.
has_attached_file :avatar, styles: { medium: '200x200>', thumb: '80x80>' }, default_url: "/icons/user.png" validates_attachment_content_type :avatar, content_type: /\aimage\/.*\z/
in case convert path /usr/bin/convert. default path. don't need specify in development.rb file. please remove , give try.
also make sure have permitted params in controller.
sample code
# in controller file private def user_params params.require(:user).permit(:email, :avatar) end
Comments
Post a Comment