3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/attach_it/storage/filesystem.rb', line 3
def flush_write(image_options = nil)
image_options.styles.each do |style_name, style_value|
begin
FileUtils.mkdir_p(File.dirname(image_options.path(style_name)))
transform(style_value, image_options.assigned_file.path).write(image_options.path(style_name))
FileUtils.chmod(0644, image_options.path(style_name))
rescue Exception => exception
image_options.add_error(exception.to_s)
end
end
unless image_options.styles.has_key?(:original)
begin
FileUtils.mkdir_p(File.dirname(image_options.path(:original)))
FileUtils.cp(image_options.assigned_file.path, image_options.path(:original))
FileUtils.chmod(0644, image_options.path(:original))
rescue Exception => exception
image_options.add_error(exception.to_s)
end
end
end
|