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