public
Description: Rails plugin for uploading images as resources, with support for resizing, text stamping, and other special effects.
Homepage: http://wiki.github.com/Squeegy/fleximage
Clone URL: git://github.com/Squeegy/fleximage.git
Added an instance level accessor for setting the jpeg compression quality in the 
view.  Example:

  @photo.jpg_compression_quality = 25
Squeegy (author)
Sun Jul 20 14:35:27 -0700 2008
commit  24a0549606c690b20729be97b1037fa1763f82db
tree    8532bb248f61a2a8e61f4a7d2dc5676fbe5d3464
parent  c0fdd7279dfc777bdb689188e1a27dcf44a2f660
...
102
103
104
 
 
 
105
106
107
...
339
340
341
 
342
343
344
345
346
 
347
348
349
...
365
366
367
368
 
369
370
371
...
102
103
104
105
106
107
108
109
110
...
342
343
344
345
346
347
348
349
350
351
352
353
354
...
370
371
372
 
373
374
375
376
0
@@ -102,6 +102,9 @@ module Fleximage
0
         # and the form needs to be redisplayed.
0
         attr_reader :image_file_temp
0
         
0
+        # Setter for jpg compression quality at the instance level
0
+        attr_accessor :jpg_compression_quality
0
+        
0
         # Where images get stored
0
         dsl_accessor :image_directory
0
         
0
@@ -339,11 +342,13 @@ module Fleximage
0
         if self.class.has_store?
0
           if self.class.db_store?
0
             if image_file_data && image_file_data.any?
0
+              # Load the image from the database column
0
               @output_image = Magick::Image.from_blob(image_file_data).first
0
             else
0
               master_image_not_found
0
             end
0
           else
0
+            # Load the image from the disk
0
             @output_image = Magick::Image.read(file_path).first
0
           end
0
         else
0
@@ -365,7 +370,7 @@ module Fleximage
0
         @output_image.format = format
0
         @output_image.strip!
0
         if format = 'JPG'
0
-          quality = self.class.output_image_jpg_quality
0
+          quality = @jpg_compression_quality || self.class.output_image_jpg_quality
0
           @output_image.to_blob { self.quality = quality }
0
         else
0
           @output_image.to_blob

Comments