has_image 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 2008-08-28 Norman Clarke <norman@randomba.org>
2
+ * Added ability to regenerate a model's thumbnails.
3
+
1
4
  2008-08-25 Norman Clarke <norman@randomba.org>
2
5
  * Fixed bad call to resize_to in view helper.
3
6
 
@@ -207,6 +207,11 @@ module HasImage
207
207
  storage.filesystem_path_for(self, thumbnail)
208
208
  end
209
209
 
210
+ # Regenerates the thumbails from the main image.
211
+ def regenerate_thumbnails
212
+ storage.regenerate_thumbnails(id, has_image_file)
213
+ end
214
+
210
215
  # Deletes the image from the storage.
211
216
  def remove_images
212
217
  return if has_image_file.blank?
@@ -102,6 +102,10 @@ module HasImage
102
102
  def valid?
103
103
  !(image_too_small? || image_too_big?)
104
104
  end
105
+
106
+ def regenerate_thumbnails(id, name)
107
+ install_thumbnails(id, name)
108
+ end
105
109
 
106
110
  protected
107
111
 
@@ -47,6 +47,15 @@ class PicTest < Test::Unit::TestCase
47
47
  assert @pic.save!
48
48
  end
49
49
 
50
+ def test_regenerate_thumbnails
51
+ Pic.has_image_options = HasImage.default_options_for(Pic).merge(
52
+ :thumbnails => {:small => "100x100", :tiny => "16x16"})
53
+ @pic = Pic.new(:image_data => fixture_file_upload("/image.jpg", "image/jpeg"))
54
+ @pic.save!
55
+ assert @pic.regenerate_thumbnails
56
+ end
57
+
58
+
50
59
  def test_create_model_without_setting_image_data
51
60
  assert Pic.new.save!
52
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-25 00:00:00 -03:00
12
+ date: 2008-08-28 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency