lib/fleximage/model.rb
# Save the image in the rails tmp directory
Save the image in the rails tmp directory
Save the image in the rails tmp directory
def save_temp_image(file)
          file_name = file.respond_to?(:original_filename) ? file.original_filename : file.path
          @image_file_temp = Time.now.to_f.to_s.sub('.', '_')
          path = "#{RAILS_ROOT}/tmp/fleximage"
          FileUtils.mkdir_p(path)
          File.open("#{path}/#{@image_file_temp}", 'wb') do |f|
            file.rewind
            f.write file.read
          end
        end
def save_temp_image ( file ) file_name = file . respond_to? ( :original_filename ) ? file . original_filename : file . path @image_file_temp = Time . now . to_f . to_s . sub ( '.' , '_' ) path = "#{RAILS_ROOT}/tmp/fleximage" FileUtils . mkdir_p ( path ) File . open ( "#{path}/#{@image_file_temp}" , 'wb' ) do | f | file . rewind f . write file . read end end
Save the image in the rails tmp directory
Save the image in the rails tmp directory
file
<not_specific>