norman-has_image 0.2.0 → 0.2.2

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,5 +1,18 @@
1
+ 2008-09-10 Norman Clarke <norman@randomba.org>
2
+ * Fixed images not being converted to target format.
3
+
4
+ 2008-08-29 Norman Clarke <norman@randomba.org>
5
+ * Fixed bad call to has_image_file
6
+
1
7
  2008-08-28 Norman Clarke <norman@randomba.org>
2
8
  * Added ability to regenerate a model's thumbnails.
9
+ * Changed a few methods in storage to accept the model rather than the id.
10
+ This makes storage more hackable as regards generating paths and file names.
11
+ * Added "has_image_id" method to model instance methods to facilitate
12
+ grouping the images under a directory structure based on a related model's
13
+ ids.
14
+ * Made the generated file name simply by the image object's id - this
15
+ is better adherance to the principle of least surprise.
3
16
 
4
17
  2008-08-25 Norman Clarke <norman@randomba.org>
5
18
  * Fixed bad call to resize_to in view helper.
@@ -140,9 +140,8 @@ module HasImage
140
140
  def install_main_image(id, name)
141
141
  FileUtils.mkdir_p path_for(id)
142
142
  main = processor.resize(@temp_file, @options[:resize_to])
143
- main.tempfile.close
144
143
  file = File.open(File.join(path_for(id), file_name_for(name)), "w")
145
- file.write(IO.read(main.tempfile.path))
144
+ file.write(IO.read(main.path))
146
145
  file.close
147
146
  main.tempfile.close!
148
147
  end
data/lib/has_image.rb CHANGED
@@ -236,7 +236,7 @@ module HasImage
236
236
  def update_images
237
237
  return if storage.temp_file.blank?
238
238
  remove_images
239
- update_attribute(:has_image_file, storage.install_images(has_image_id))
239
+ update_attribute(:has_image_file, storage.install_images(self))
240
240
  end
241
241
 
242
242
  # Processes and installs the image and its thumbnails.
@@ -1,4 +1,4 @@
1
- require 'test_helper.rb'
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
3
  class StorageTest < Test::Unit::TestCase
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norman-has_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
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-28 00:00:00 -07:00
12
+ date: 2008-09-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency