public
Fork of technoweenie/attachment_fu
Description: Treat an ActiveRecord model as a file attachment, storing its patch, size, content type, etc.
Homepage: http://weblog.techno-weenie.net
Clone URL: git://github.com/ismasan/attachment_fu.git
Search Repo:
Applied patch from Christoph Lupprich to correct file handling in core 
image processor for attachment fu: 
http://ar-code.lighthouseapp.com/projects/35/tickets/24-patch-coreimage-re
sizes-main-attachment-as-well-as-thumbnails
crafterm (author)
Wed May 21 20:47:59 -0700 2008
commit  834553ad3d876541b986ed6de115ea0023070bb5
tree    4a175a97a65b7c694f5cc496d4d4fc8880153e22
parent  61ad36fb73de927ace41689999187076496934df
...
44
45
46
 
 
 
47
48
49
...
44
45
46
47
48
49
50
51
52
0
@@ -44,6 +44,9 @@ module Technoweenie # :nodoc:
0
             processor.render do |result|
0
               self.width = result.extent.size.width if respond_to?(:width)
0
               self.height = result.extent.size.height if respond_to?(:height)
0
+
0
+ # Get a new temp_path for the image before saving
0
+ self.temp_path = Tempfile.new(random_tempfile_filename, Technoweenie::AttachmentFu.tempfile_path).path
0
               result.save self.temp_path, OSX::NSJPEGFileType
0
               self.size = File.size(self.temp_path)
0
             end
...
22
23
24
 
 
 
 
 
 
25
26
27
...
22
23
24
25
26
27
28
29
30
31
32
33
0
@@ -22,6 +22,12 @@ class CoreImageTest < Test::Unit::TestCase
0
       # test geometry string
0
       assert_equal 31, geo.width
0
       assert_equal 41, geo.height
0
+
0
+ # This makes sure that we didn't overwrite the original file
0
+ # and will end up with a thumbnail instead of the original
0
+ assert_equal 42, attachment.width
0
+ assert_equal 55, attachment.height
0
+
0
     end
0
   else
0
     def test_flunk

Comments

    No one has commented yet.