public
Fork of technoweenie/attachment_fu
Description: Fork of attachment_fu patched so that thumbnails can be generated without squashing/stretching them when using MiniMagick
Homepage: http://weblog.techno-weenie.net
Clone URL: git://github.com/tekin/attachment_fu.git
Add support for Core Image in attachment_fu via a new core_image_processor 
class that uses a vendor imported mini core image library.
Updated attachment_fu to automatically use core image when available and 
fall back to Image Science, Rmagick and MiniMagick when not available.
crafterm (author)
Thu Feb 21 00:16:53 -0800 2008
commit  d971859124fbefb4e7d9d1ea046789d1680c8ddc
tree    1ac90ea30ad8fe07cfaa05175fdf60fe9177bafc
parent  ca63a36dbc61b0b8dad91516bb0ae98f328d8be6
...
11
12
13
14
15
 
 
 
...
11
12
13
 
14
15
16
17
0
@@ -11,4 +11,6 @@ end
0
 require 'geometry'
0
 ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
0
 Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
0
-FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
0
\ No newline at end of file
0
+FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
0
+
0
+$:.unshift(File.dirname(__FILE__) + '/vendor')
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 module Technoweenie # :nodoc:
0
   module AttachmentFu # :nodoc:
0
- @@default_processors = %w(ImageScience Rmagick MiniMagick)
0
+ @@default_processors = %w(CoreImage ImageScience Rmagick MiniMagick)
0
     @@tempfile_path = File.join(RAILS_ROOT, 'tmp', 'attachment_fu')
0
     @@content_types = ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg']
0
     mattr_reader :content_types, :tempfile_path, :default_processors
...
95
96
97
 
 
 
 
 
 
 
 
 
 
98
99
100
...
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
0
@@ -95,6 +95,16 @@ rescue MissingSourceFile
0
 end
0
 
0
 begin
0
+ class CoreImageAttachment < ActiveRecord::Base
0
+ has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
0
+ :processor => :core_image, :thumbnails => { :thumb => [50, 51], :geometry => '31>' }, :resize_to => 55
0
+ end
0
+rescue MissingSourceFile
0
+ puts $!.message
0
+ puts "no CoreImage"
0
+end
0
+
0
+begin
0
   class MiniMagickAttachment < ActiveRecord::Base
0
     has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
0
       :processor => :mini_magick, :thumbnails => { :thumb => [50, 51], :geometry => '31>' }, :resize_to => 55
...
34
35
36
 
 
 
 
 
 
 
 
 
 
 
37
38
39
...
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
0
@@ -34,6 +34,17 @@ ActiveRecord::Schema.define(:version => 0) do
0
     t.column :type, :string
0
   end
0
 
0
+ create_table :core_image_attachments, :force => true do |t|
0
+ t.column :parent_id, :integer
0
+ t.column :thumbnail, :string
0
+ t.column :filename, :string, :limit => 255
0
+ t.column :content_type, :string, :limit => 255
0
+ t.column :size, :integer
0
+ t.column :width, :integer
0
+ t.column :height, :integer
0
+ t.column :type, :string
0
+ end
0
+
0
   create_table :mini_magick_attachments, :force => true do |t|
0
     t.column :parent_id, :integer
0
     t.column :thumbnail, :string

Comments

    No one has commented yet.