app/models/gallery.rb
# Insert in this Gallery all picture in
# the import table. The import model is use
# only for the save of all file there are in this directory
# All file are integrate in this gallery time after time
# If the directory finish by / it's delete
Insert in this Gallery all picture in
the import table. The import model is use
only for the save of all file there are in this directory
All file are integrate in this gallery time after time
If the directory finish by / it's delete
Insert in this Gallery all picture in the import table . The import model is use only for the save of all file there are in this directory All file are integrate in this gallery time after time If the directory finish by / it ' s delete
def insert_pictures(directory)
    list_import = []
    Dir.chdir(directory) do
      Dir.glob("*.{gif,png,jpg,bmp}", File::FNM_CASEFOLD) do |file|
        i = Import.new
        directory.chop! if directory[-1,1] == '/'
        i.path = "#{directory}/#{file}"
        i.gallery = self
        list_import << i
      end
      list_import.each { |i|
        i.total = list_import.size
        i.save!
      }
    end if File.directory? directory
    list_import
  end
def insert_pictures ( directory ) list_import = [ ] Dir . chdir ( directory ) do Dir . glob ( "*.{gif,png,jpg,bmp}" , File :: FNM_CASEFOLD ) do | file | i = Import . new directory . chop! if directory [ - 1 , 1 ] == '/' i . path = "#{directory}/#{file}" i . gallery = self list_import << i end list_import . each { | i | i . total = list_import . size i . save! } end if File . directory? directory list_import end
Insert in this Gallery all picture in
the import table.
Insert in this Gallery all picture in the import table .
# Save the import with the total size for this import
directory
<not_specific>