photo_folder 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,13 +91,13 @@ class Photo < ActiveRecord::Base
91
91
  self.date = (Time.mktime(date_match[1],date_match[2],date_match[3],date_match[4],date_match[5],date_match[6])).to_i
92
92
  end
93
93
  end
94
- self.name = exif[:title] || full_path.split('/').pop.gsub(/\.[a-zA-Z]{1,4}/,'')
94
+ self.name = exif[:title] || Photo.name_from_path(full_path)
95
95
  self.lens = exif[:lens] ? exif[:lens] : nil
96
96
  @tags = exif[:tags] || []
97
97
  end
98
98
 
99
99
  def set_exif_data_without_mini_exiftool
100
- self.name = full_path.split('/').pop.gsub(/\.[a-zA-Z]{1,4}/,'')
100
+ self.name = Photo.name_from_path(full_path)
101
101
  if(full_path.match(/\.png$/))
102
102
  width, height = File.read(full_path)[0x10..0x18].unpack('NN')
103
103
  else
@@ -110,6 +110,10 @@ class Photo < ActiveRecord::Base
110
110
  @tags = []
111
111
  end
112
112
 
113
+ def self.name_from_path(path)
114
+ path.split('/').pop.gsub(/\.[a-zA-Z]{1,4}/,'').gsub(/^[\d]{1,3}\-/,'')
115
+ end
116
+
113
117
  class EXIFData
114
118
  EXIF_TRANSLATIONS = {
115
119
  :title => ['Title','ObjectName'],
@@ -262,6 +262,10 @@ module PhotoFolder
262
262
  puts "Unable to add photo: #{path}"
263
263
  end
264
264
  end
265
+ puts "Putting added photos in collections."
266
+ PhotoCollection.find(:all).each do |photo_collection|
267
+ photo_collection.set_children_parent_id
268
+ end
265
269
  else
266
270
  puts "No photos to add."
267
271
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "photo_folder"
3
- s.version = "1.1.1"
3
+ s.version = "1.1.2"
4
4
  s.date = "2010-05-27"
5
5
  s.summary = "JavaScript gallery"
6
6
  s.email = "ryan@syntacticx.com"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photo_folder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Johnson