change file permissioons to work with web server

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@139 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-02-05 03:54:12 +00:00
parent af01a92e03
commit 743a614a3a
1 changed files with 3 additions and 0 deletions

View File

@ -70,6 +70,7 @@ class Image < ActiveRecord::Base
Dir.mkdir(base_directory) unless File.exist?(base_directory) Dir.mkdir(base_directory) unless File.exist?(base_directory)
self.original = File.basename(@file.original_filename).gsub(/[^\w._-]/, '') self.original = File.basename(@file.original_filename).gsub(/[^\w._-]/, '')
@magick_image.write("#{base_directory}/#{self.original}") @magick_image.write("#{base_directory}/#{self.original}")
File.chmod(0644, "#{base_directory}/#{self.original}")
@magick_image.thumbnail("600x600>") @magick_image.thumbnail("600x600>")
self.screen = "screen_#{self.original}" self.screen = "screen_#{self.original}"
@magick_image.write("#{base_directory}/#{self.screen}") @magick_image.write("#{base_directory}/#{self.screen}")
@ -77,9 +78,11 @@ class Image < ActiveRecord::Base
self.screen_width = $1 self.screen_width = $1
self.screen_height = $2 self.screen_height = $2
end end
File.chmod(0644, "#{base_directory}/#{self.screen}")
@magick_image.thumbnail("50x50>") @magick_image.thumbnail("50x50>")
self.thumbnail = "thumbnail_#{self.original}" self.thumbnail = "thumbnail_#{self.original}"
@magick_image.write("#{base_directory}/#{self.thumbnail}") @magick_image.write("#{base_directory}/#{self.thumbnail}")
File.chmod(0644, "#{base_directory}/#{self.thumbnail}")
self.save self.save
end end