resize img
This commit is contained in:
parent
ff9bde0b9f
commit
5cacdd906d
1
Gemfile
1
Gemfile
|
@ -7,6 +7,7 @@ gem "coderay", "~> 1.0.6"
|
|||
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||||
gem "builder", "3.0.0"
|
||||
gem 'acts-as-taggable-on'
|
||||
gem 'rmagick'
|
||||
|
||||
# Optional gem for LDAP authentication
|
||||
group :ldap do
|
||||
|
|
|
@ -78,6 +78,7 @@ GEM
|
|||
rake (10.0.4)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
rmagick (2.13.2)
|
||||
ruby-openid (2.1.8)
|
||||
sprockets (2.2.2)
|
||||
hike (~> 1.2)
|
||||
|
@ -108,4 +109,5 @@ DEPENDENCIES
|
|||
rack-openid
|
||||
rails (= 3.2.13)
|
||||
rdoc (>= 2.4.2)
|
||||
rmagick
|
||||
ruby-openid (~> 2.1.4)
|
||||
|
|
|
@ -55,11 +55,12 @@ class AvatarController < ApplicationController
|
|||
# saved = @avatar.save
|
||||
begin
|
||||
f = Magick::ImageList.new(diskfile)
|
||||
f.scale!(100,100)
|
||||
proportion = (200.0/f[0].columns)
|
||||
f.resize_to_fill!(200,200)
|
||||
#f.scale!(50,50)
|
||||
f.write(diskfile)
|
||||
rescue Exception => e
|
||||
logger.error "[avatar] Error : avatar_cntroller#upload ===> #{e}"
|
||||
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue