public
Description: Rails plugin for uploading images as resources, with support for resizing, text stamping, and other special effects.
Homepage: http://fleximage.rubyforge.org
Clone URL: git://github.com/Squeegy/fleximage.git
Added fleximage:dimensions rake task for populating width and height magic 
columns.  [#3 state:resolved]
Squeegy (author)
Mon Jun 09 21:22:12 -0700 2008
commit  38e089712fbf1afaf7809b43923b76572ad9882e
tree    faaa0f949057ae0ee43677349ad9b057b171c4fe
parent  192ddcb95af577e9e390ea13b24fa27470844d32
...
1
2
3
4
5
6
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
9
 
 
 
 
10
11
12
...
1
 
 
 
 
 
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
18
19
20
21
22
23
24
0
@@ -1,12 +1,24 @@
0
 namespace :fleximage do
0
- namespace :convert do
0
-
0
- # Find the model class
0
- def model_class
0
- raise 'You must specify a FLEXIMAGE_CLASS=MyClass' unless ENV['FLEXIMAGE_CLASS']
0
- @model_class ||= ENV['FLEXIMAGE_CLASS'].camelcase.constantize
0
+
0
+ # Find the model class
0
+ def model_class
0
+ raise 'You must specify a FLEXIMAGE_CLASS=MyClass' unless ENV['FLEXIMAGE_CLASS']
0
+ @model_class ||= ENV['FLEXIMAGE_CLASS'].camelcase.constantize
0
+ end
0
+
0
+ desc "Populate width and height magic columns from the current image store. Useful when migrating from on old installation."
0
+ task :dimensions => :environment do
0
+ model_class.find(:all).each do |obj|
0
+ if obj.has_image?
0
+ img = obj.load_image
0
+ obj.update_attribute :image_width, img.columns if obj.respond_to?(:image_width=)
0
+ obj.update_attribute :image_height, img.rows if obj.respond_to?(:image_height=)
0
+ end
0
     end
0
-
0
+ end
0
+
0
+ namespace :convert do
0
+
0
     def convert_directory_format(to_format)
0
       model_class.find(:all).each do |obj|
0
         

Comments

    No one has commented yet.