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
Search Repo:
rdoc update
Squeegy (author)
Sat Apr 12 13:32:36 -0700 2008
commit  aff901aec01ec23110b700cd1480f63420e8baad
tree    291cef9e67f40561de984f7d058b2b9ad03641f7
parent  94510c8e68e7e755fc889232cdc6a86cbb402dcd
...
36
37
38
 
 
39
40
41
...
50
51
52
 
53
54
55
...
36
37
38
39
40
41
42
43
...
52
53
54
55
56
57
58
0
@@ -36,6 +36,8 @@
0
     # * +output_image_jpg_quality+: (Integer, default 85) When rendering JPGs, this represents the amount of
0
     # compression. Valid values are 0-100, where 0 is very small and very ugly, and 100 is near lossless but
0
     # very large in filesize.
0
+ # * +default_image_path+: (String, nil default) If no image is present for this record, the image at this path will be
0
+ # used instead. Useful for a placeholder graphic for new content that may not have an image just yet.
0
     # * +preprocess_image+: (Block, no default) Call this class method just like you would call +operate+ in a view.
0
     # The image transoformation in the provided block will be run on every uploaded image before its saved as the
0
     # master image.
0
@@ -50,6 +52,7 @@
0
     # require_image true
0
     # missing_image_message 'is required'
0
     # invalid_image_message 'was not a readable image'
0
+ # default_image_path 'public/images/no_photo_yet.png'
0
     # output_image_jpg_quality 85
0
     #
0
     # preprocess_image do |image|
...
123
124
125
 
 
 
 
 
126
127
128
...
142
143
144
 
145
146
147
...
210
211
212
213
214
215
216
217
218
 
 
 
 
 
 
219
220
221
...
240
241
242
243
244
245
246
 
 
 
 
247
248
249
250
251
252
253
254
255
256
257
258
259
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
300
301
 
 
302
303
304
 
 
305
306
307
 
 
308
309
310
 
 
311
312
313
 
 
314
315
316
 
 
317
318
319
 
 
320
321
322
323
324
325
326
327
328
329
330
331
332
 
 
 
 
 
 
 
 
 
 
 
 
333
334
335
 
 
336
337
338
339
340
341
342
 
 
 
 
 
 
 
 
 
343
344
345
...
123
124
125
126
127
128
129
130
131
132
133
...
147
148
149
150
151
152
153
...
216
217
218
 
 
 
 
 
 
219
220
221
222
223
224
225
226
227
...
246
247
248
 
 
 
 
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
...
278
279
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
 
 
303
304
305
 
 
306
307
308
 
 
309
310
311
 
 
312
313
314
 
 
315
316
317
 
 
318
319
320
 
 
321
322
323
 
 
 
 
 
 
 
 
 
 
 
 
324
325
326
327
328
329
330
331
332
333
334
335
336
 
 
337
338
339
 
 
 
 
 
 
340
341
342
343
344
345
346
347
348
349
350
351
0
@@ -123,6 +123,11 @@
0
 large in filesize.
0
 
0
 </li>
0
+<li><tt>default_image_path</tt>: (String, nil default) If no image is present
0
+for this record, the image at this path will be used instead. Useful for a
0
+placeholder graphic for new content that may not have an image just yet.
0
+
0
+</li>
0
 <li><tt><a href="ClassMethods.html#M000002">preprocess_image</a></tt>: (Block,
0
 no default) Call this class method just like you would call
0
 <tt>operate</tt> in a view. The image transoformation in the provided block
0
@@ -142,6 +147,7 @@
0
       require_image true
0
       missing_image_message 'is required'
0
       invalid_image_message 'was not a readable image'
0
+ default_image_path 'public/images/no_photo_yet.png'
0
       output_image_jpg_quality 85
0
 
0
       preprocess_image do |image|
0
@@ -210,12 +216,12 @@
0
             onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000003-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 82</span>
0
-82: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">db_store?</span>
0
-83: <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span><span class="ruby-operator">|</span>
0
-84: <span class="ruby-identifier">col</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'image_file_data'</span>
0
-85: <span class="ruby-keyword kw">end</span>
0
-86: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 85</span>
0
+85: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">db_store?</span>
0
+86: <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span><span class="ruby-operator">|</span>
0
+87: <span class="ruby-identifier">col</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'image_file_data'</span>
0
+88: <span class="ruby-keyword kw">end</span>
0
+89: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
@@ -240,10 +246,10 @@
0
             onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000002-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 77</span>
0
-77: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">preprocess_image</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
0
-78: <span class="ruby-identifier">preprocess_image_operation</span>(<span class="ruby-identifier">block</span>)
0
-79: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 80</span>
0
+80: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">preprocess_image</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
0
+81: <span class="ruby-identifier">preprocess_image_operation</span>(<span class="ruby-identifier">block</span>)
0
+82: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
0
0
0
0
0
0
0
0
0
0
@@ -272,74 +278,74 @@
0
             onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000001-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 68</span>
0
- 68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_as_fleximage</span>(<span class="ruby-identifier">options</span> = {})
0
- 69:
0
- 70: <span class="ruby-comment cmt"># Insert class methods</span>
0
- 71: <span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
0
- 72: <span class="ruby-identifier">include</span> <span class="ruby-constant">Fleximage</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceMethods</span>
0
- 73:
0
- 74: <span class="ruby-comment cmt"># Call this class method just like you would call +operate+ in a view.</span>
0
- 75: <span class="ruby-comment cmt"># The image transoformation in the provided block will be run on every uploaded image before its saved as the </span>
0
- 76: <span class="ruby-comment cmt"># master image.</span>
0
- 77: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">preprocess_image</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
0
- 78: <span class="ruby-identifier">preprocess_image_operation</span>(<span class="ruby-identifier">block</span>)
0
- 79: <span class="ruby-keyword kw">end</span>
0
- 80:
0
- 81: <span class="ruby-comment cmt"># Internal method to ask this class if it stores image in the DB.</span>
0
- 82: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">db_store?</span>
0
- 83: <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span><span class="ruby-operator">|</span>
0
- 84: <span class="ruby-identifier">col</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'image_file_data'</span>
0
- 85: <span class="ruby-keyword kw">end</span>
0
- 86: <span class="ruby-keyword kw">end</span>
0
- 87: <span class="ruby-keyword kw">end</span>
0
- 88:
0
- 89: <span class="ruby-comment cmt"># Where images get stored</span>
0
- 90: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:image_directory</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 71</span>
0
+ 71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_as_fleximage</span>(<span class="ruby-identifier">options</span> = {})
0
+ 72:
0
+ 73: <span class="ruby-comment cmt"># Insert class methods</span>
0
+ 74: <span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
0
+ 75: <span class="ruby-identifier">include</span> <span class="ruby-constant">Fleximage</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceMethods</span>
0
+ 76:
0
+ 77: <span class="ruby-comment cmt"># Call this class method just like you would call +operate+ in a view.</span>
0
+ 78: <span class="ruby-comment cmt"># The image transoformation in the provided block will be run on every uploaded image before its saved as the </span>
0
+ 79: <span class="ruby-comment cmt"># master image.</span>
0
+ 80: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">preprocess_image</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
0
+ 81: <span class="ruby-identifier">preprocess_image_operation</span>(<span class="ruby-identifier">block</span>)
0
+ 82: <span class="ruby-keyword kw">end</span>
0
+ 83:
0
+ 84: <span class="ruby-comment cmt"># Internal method to ask this class if it stores image in the DB.</span>
0
+ 85: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">db_store?</span>
0
+ 86: <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span><span class="ruby-operator">|</span>
0
+ 87: <span class="ruby-identifier">col</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'image_file_data'</span>
0
+ 88: <span class="ruby-keyword kw">end</span>
0
+ 89: <span class="ruby-keyword kw">end</span>
0
+ 90: <span class="ruby-keyword kw">end</span>
0
  91:
0
- 92: <span class="ruby-comment cmt"># Put uploads from different days into different subdirectories</span>
0
- 93: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:use_creation_date_based_directories</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
0
+ 92: <span class="ruby-comment cmt"># Where images get stored</span>
0
+ 93: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:image_directory</span>
0
  94:
0
- 95: <span class="ruby-comment cmt"># The format are master images are stored in</span>
0
- 96: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:image_storage_format</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">:png</span> }
0
+ 95: <span class="ruby-comment cmt"># Put uploads from different days into different subdirectories</span>
0
+ 96: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:use_creation_date_based_directories</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
0
  97:
0
- 98: <span class="ruby-comment cmt"># Require a valid image. Defaults to true. Set to false if its ok to have no image for</span>
0
- 99: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:require_image</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
0
+ 98: <span class="ruby-comment cmt"># The format are master images are stored in</span>
0
+ 99: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:image_storage_format</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">:png</span> }
0
 100:
0
-101: <span class="ruby-comment cmt"># Missing image message</span>
0
-102: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:missing_image_message</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'is required'</span>
0
+101: <span class="ruby-comment cmt"># Require a valid image. Defaults to true. Set to false if its ok to have no image for</span>
0
+102: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:require_image</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
0
 103:
0
-104: <span class="ruby-comment cmt"># Invalid image message</span>
0
-105: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:invalid_image_message</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'was not a readable image'</span>
0
+104: <span class="ruby-comment cmt"># Missing image message</span>
0
+105: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:missing_image_message</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'is required'</span>
0
 106:
0
-107: <span class="ruby-comment cmt"># Sets the quality of rendered JPGs</span>
0
-108: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:output_image_jpg_quality</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">85</span>
0
+107: <span class="ruby-comment cmt"># Invalid image message</span>
0
+108: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:invalid_image_message</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'was not a readable image'</span>
0
 109:
0
-110: <span class="ruby-comment cmt"># Set a default image to use when no image has been assigned to this record</span>
0
-111: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:default_image_path</span>
0
+110: <span class="ruby-comment cmt"># Sets the quality of rendered JPGs</span>
0
+111: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:output_image_jpg_quality</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">85</span>
0
 112:
0
-113: <span class="ruby-comment cmt"># A block that processes an image before it gets saved as the master image of a record.</span>
0
-114: <span class="ruby-comment cmt"># Can be helpful to resize potentially huge images to something more manageable. Set via</span>
0
-115: <span class="ruby-comment cmt"># the &quot;preprocess_image { |image| ... }&quot; class method.</span>
0
-116: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:preprocess_image_operation</span>
0
-117:
0
-118: <span class="ruby-comment cmt"># Image related save and destroy callbacks</span>
0
-119: <span class="ruby-identifier">after_destroy</span> <span class="ruby-identifier">:delete_image_file</span>
0
-120: <span class="ruby-identifier">before_save</span> <span class="ruby-identifier">:pre_save</span>
0
-121: <span class="ruby-identifier">after_save</span> <span class="ruby-identifier">:post_save</span>
0
-122:
0
-123: <span class="ruby-comment cmt"># execute configuration block</span>
0
-124: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
0
+113: <span class="ruby-comment cmt"># Set a default image to use when no image has been assigned to this record</span>
0
+114: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:default_image_path</span>
0
+115:
0
+116: <span class="ruby-comment cmt"># A block that processes an image before it gets saved as the master image of a record.</span>
0
+117: <span class="ruby-comment cmt"># Can be helpful to resize potentially huge images to something more manageable. Set via</span>
0
+118: <span class="ruby-comment cmt"># the &quot;preprocess_image { |image| ... }&quot; class method.</span>
0
+119: <span class="ruby-identifier">dsl_accessor</span> <span class="ruby-identifier">:preprocess_image_operation</span>
0
+120:
0
+121: <span class="ruby-comment cmt"># Image related save and destroy callbacks</span>
0
+122: <span class="ruby-identifier">after_destroy</span> <span class="ruby-identifier">:delete_image_file</span>
0
+123: <span class="ruby-identifier">before_save</span> <span class="ruby-identifier">:pre_save</span>
0
+124: <span class="ruby-identifier">after_save</span> <span class="ruby-identifier">:post_save</span>
0
 125:
0
-126: <span class="ruby-comment cmt"># set the image directory from passed options</span>
0
-127: <span class="ruby-identifier">image_directory</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:image_directory</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:image_directory</span>]
0
+126: <span class="ruby-comment cmt"># execute configuration block</span>
0
+127: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
0
 128:
0
-129: <span class="ruby-comment cmt"># Require the declaration of a master image storage directory</span>
0
-130: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">image_directory</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">db_store?</span>
0
-131: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;No place to put images! Declare this via the :image_directory =&gt; 'path/to/directory' option\n&quot;</span><span class="ruby-operator">+</span>
0
-132: <span class="ruby-value str">&quot;Or add a database column named image_file_data for DB storage&quot;</span>
0
-133: <span class="ruby-keyword kw">end</span>
0
-134: <span class="ruby-keyword kw">end</span>
0
+129: <span class="ruby-comment cmt"># set the image directory from passed options</span>
0
+130: <span class="ruby-identifier">image_directory</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:image_directory</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:image_directory</span>]
0
+131:
0
+132: <span class="ruby-comment cmt"># Require the declaration of a master image storage directory</span>
0
+133: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">image_directory</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">db_store?</span>
0
+134: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;No place to put images! Declare this via the :image_directory =&gt; 'path/to/directory' option\n&quot;</span><span class="ruby-operator">+</span>
0
+135: <span class="ruby-value str">&quot;Or add a database column named image_file_data for DB storage&quot;</span>
0
+136: <span class="ruby-keyword kw">end</span>
0
+137: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
...
134
135
136
137
138
139
140
 
 
 
 
141
142
143
144
...
171
172
173
174
175
176
177
178
179
 
 
 
180
181
182
183
184
185
186
187
188
 
 
 
 
 
 
 
 
 
 
 
189
190
191
...
211
212
213
214
215
216
217
 
 
 
 
218
219
220
...
237
238
239
240
241
242
243
 
 
 
 
244
245
246
...
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
320
321
...
340
341
342
343
344
345
346
 
 
 
 
347
348
349
350
...
373
374
375
376
377
378
379
380
381
382
383
 
 
 
 
 
384
385
386
387
388
389
390
391
 
 
 
 
 
 
 
 
 
 
392
393
394
...
420
421
422
423
424
425
426
427
428
429
430
 
 
 
 
 
 
 
 
431
432
433
...
134
135
136
 
 
 
 
137
138
139
140
141
142
143
144
...
171
172
173
 
 
 
 
 
 
174
175
176
177
 
 
 
 
 
 
 
 
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
211
212
213
 
 
 
 
214
215
216
217
218
219
220
...
237
238
239
 
 
 
 
240
241
242
243
244
245
246
...
285
286
287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
340
341
342
 
 
 
 
343
344
345
346
347
348
349
350
...
373
374
375
 
 
 
 
 
 
 
 
376
377
378
379
380
381
 
 
 
 
 
 
 
382
383
384
385
386
387
388
389
390
391
392
393
394
...
420
421
422
 
 
 
 
 
 
 
 
423
424
425
426
427
428
429
430
431
432
433
0
@@ -134,10 +134,10 @@
0
             onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000011-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 324</span>
0
-324: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_image_file</span>
0
-325: <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">file_path</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_path</span>)
0
-326: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 327</span>
0
+327: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_image_file</span>
0
+328: <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">file_path</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_path</span>)
0
+329: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
0
@@ -171,21 +171,21 @@
0
             onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000004-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 149</span>
0
-149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directory_path</span>
0
-150: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'No image directory was defined, cannot generate path'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">image_directory</span>
0
-151:
0
-152: <span class="ruby-comment cmt"># base directory</span>
0
-153: <span class="ruby-identifier">directory</span> = <span class="ruby-node">&quot;#{RAILS_ROOT}/#{self.class.image_directory}&quot;</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 152</span>
0
+152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directory_path</span>
0
+153: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'No image directory was defined, cannot generate path'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">image_directory</span>
0
 154:
0
-155: <span class="ruby-comment cmt"># specific creation date based directory suffix.</span>
0
-156: <span class="ruby-identifier">creation</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">:created_at</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">:created_on</span>]
0
-157: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">use_creation_date_based_directories</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">creation</span>
0
-158: <span class="ruby-node">&quot;#{directory}/#{creation.year}/#{creation.month}/#{creation.day}&quot;</span>
0
-159: <span class="ruby-keyword kw">else</span>
0
-160: <span class="ruby-identifier">directory</span>
0
-161: <span class="ruby-keyword kw">end</span>
0
-162: <span class="ruby-keyword kw">end</span>
0
+155: <span class="ruby-comment cmt"># base directory</span>
0
+156: <span class="ruby-identifier">directory</span> = <span class="ruby-node">&quot;#{RAILS_ROOT}/#{self.class.image_directory}&quot;</span>
0
+157:
0
+158: <span class="ruby-comment cmt"># specific creation date based directory suffix.</span>
0
+159: <span class="ruby-identifier">creation</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">:created_at</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">:created_on</span>]
0
+160: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">use_creation_date_based_directories</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">creation</span>
0
+161: <span class="ruby-node">&quot;#{directory}/#{creation.year}/#{creation.month}/#{creation.day}&quot;</span>
0
+162: <span class="ruby-keyword kw">else</span>
0
+163: <span class="ruby-identifier">directory</span>
0
+164: <span class="ruby-keyword kw">end</span>
0
+165: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
@@ -211,10 +211,10 @@
0
             onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000005-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 167</span>
0
-167: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">file_path</span>
0
-168: <span class="ruby-node">&quot;#{directory_path}/#{id}.#{self.class.image_storage_format}&quot;</span>
0
-169: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 170</span>
0
+170: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">file_path</span>
0
+171: <span class="ruby-node">&quot;#{directory_path}/#{id}.#{self.class.image_storage_format}&quot;</span>
0
+172: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
@@ -237,10 +237,10 @@
0
             onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000009-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 261</span>
0
-261: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_image?</span>
0
-262: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">db_store?</span> <span class="ruby-value">? </span><span class="ruby-identifier">image_file_data</span> <span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_path</span>)
0
-263: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 264</span>
0
+264: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_image?</span>
0
+265: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">db_store?</span> <span class="ruby-value">? </span><span class="ruby-identifier">image_file_data</span> <span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_path</span>)
0
+266: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
@@ -285,37 +285,37 @@
0
             onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000006-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 193</span>
0
-193: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_file=</span>(<span class="ruby-identifier">file</span>)
0
-194: <span class="ruby-comment cmt"># Get the size of the file. file.size works for form-uploaded images, file.stat.size works</span>
0
-195: <span class="ruby-comment cmt"># for file object created by File.open('foo.jpg', 'rb')</span>
0
-196: <span class="ruby-identifier">file_size</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:size</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">size</span>
0
-197:
0
-198: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:read</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">file_size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
0
-199: <span class="ruby-comment cmt"># Create RMagick Image object from uploaded file</span>
0
-200: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">path</span>
0
-201: <span class="ruby-ivar">@uploaded_image</span> = <span class="ruby-constant">Magick</span><span class="ruby-operator">::</span><span class="ruby-constant">Image</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">first</span>
0
-202: <span class="ruby-keyword kw">else</span>
0
-203: <span class="ruby-ivar">@uploaded_image</span> = <span class="ruby-constant">Magick</span><span class="ruby-operator">::</span><span class="ruby-constant">Image</span>.<span class="ruby-identifier">from_blob</span>(<span class="ruby-identifier">file</span>.<span class="ruby-identifier">read</span>).<span class="ruby-identifier">first</span>
0
-204: <span class="ruby-keyword kw">end</span>
0
-205:
0
-206: <span class="ruby-identifier">set_magic_attributes</span>(<span class="ruby-identifier">file</span>)
0
-207:
0
-208: <span class="ruby-comment cmt"># Success, make sure everything is valid</span>
0
-209: <span class="ruby-ivar">@missing_image</span> = <span class="ruby-keyword kw">false</span>
0
-210: <span class="ruby-ivar">@invalid_image</span> = <span class="ruby-keyword kw">false</span>
0
-211: <span class="ruby-keyword kw">else</span>
0
-212: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">require_image</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@uploaded_image</span>
0
-213: <span class="ruby-ivar">@missing_image</span> = <span class="ruby-keyword kw">true</span>
0
-214: <span class="ruby-keyword kw">end</span>
0
-215: <span class="ruby-keyword kw">end</span>
0
-216: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Magick</span><span class="ruby-operator">::</span><span class="ruby-constant">ImageMagickError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
0
-217: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/no decode delegate for this image format/</span>
0
-218: <span class="ruby-ivar">@invalid_image</span> = <span class="ruby-keyword kw">true</span>
0
-219: <span class="ruby-keyword kw">else</span>
0
-220: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
0
-221: <span class="ruby-keyword kw">end</span>
0
-222: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 196</span>
0
+196: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_file=</span>(<span class="ruby-identifier">file</span>)
0
+197: <span class="ruby-comment cmt"># Get the size of the file. file.size works for form-uploaded images, file.stat.size works</span>
0
+198: <span class="ruby-comment cmt"># for file object created by File.open('foo.jpg', 'rb')</span>
0
+199: <span class="ruby-identifier">file_size</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:size</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">size</span>
0
+200:
0
+201: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:read</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">file_size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
0
+202: <span class="ruby-comment cmt"># Create RMagick Image object from uploaded file</span>
0
+203: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">path</span>
0
+204: <span class="ruby-ivar">@uploaded_image</span> = <span class="ruby-constant">Magick</span><span class="ruby-operator">::</span><span class="ruby-constant">Image</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">first</span>
0
+205: <span class="ruby-keyword kw">else</span>
0
+206: <span class="ruby-ivar">@uploaded_image</span> = <span class="ruby-constant">Magick</span><span class="ruby-operator">::</span><span class="ruby-constant">Image</span>.<span class="ruby-identifier">from_blob</span>(<span class="ruby-identifier">file</span>.<span class="ruby-identifier">read</span>).<span class="ruby-identifier">first</span>
0
+207: <span class="ruby-keyword kw">end</span>
0
+208:
0
+209: <span class="ruby-identifier">set_magic_attributes</span>(<span class="ruby-identifier">file</span>)
0
+210:
0
+211: <span class="ruby-comment cmt"># Success, make sure everything is valid</span>
0
+212: <span class="ruby-ivar">@missing_image</span> = <span class="ruby-keyword kw">false</span>
0
+213: <span class="ruby-ivar">@invalid_image</span> = <span class="ruby-keyword kw">false</span>
0
+214: <span class="ruby-keyword kw">else</span>
0
+215: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">require_image</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@uploaded_image</span>
0
+216: <span class="ruby-ivar">@missing_image</span> = <span class="ruby-keyword kw">true</span>
0
+217: <span class="ruby-keyword kw">end</span>
0
+218: <span class="ruby-keyword kw">end</span>
0
+219: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Magick</span><span class="ruby-operator">::</span><span class="ruby-constant">ImageMagickError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
0
+220: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/no decode delegate for this image format/</span>
0
+221: <span class="ruby-ivar">@invalid_image</span> = <span class="ruby-keyword kw">true</span>
0
+222: <span class="ruby-keyword kw">else</span>
0
+223: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
0
+224: <span class="ruby-keyword kw">end</span>
0
+225: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
@@ -340,10 +340,10 @@
0
             onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000008-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 256</span>
0
-256: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_file_url</span>
0
-257: <span class="ruby-ivar">@image_file_url</span>
0
-258: <span class="ruby-keyword kw">end</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 259</span>
0
+259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_file_url</span>
0
+260: <span class="ruby-ivar">@image_file_url</span>
0
+261: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
0
@@ -373,22 +373,22 @@
0
             onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000007-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 231</span>
0
-231: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_file_url=</span>(<span class="ruby-identifier">file_url</span>)
0
-232: <span class="ruby-ivar">@image_file_url</span> = <span class="ruby-identifier">file_url</span>
0
-233: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file_url</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r{^https?://}</span>
0
-234: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_url</span>)
0
-235:
0
-236: <span class="ruby-comment cmt"># Force a URL based file to have an original_filename</span>
0
-237: <span class="ruby-identifier">eval</span> <span class="ruby-value str">&quot;class &lt;&lt; file\ndef original_filename\n\&quot;\#{file_url}\&quot;\nend\nend\n&quot;</span>
0
+ <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 234</span>
0
+234: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_file_url=</span>(<span class="ruby-identifier">file_url</span>)
0
+235: <span class="ruby-ivar">@image_file_url</span> = <span class="ruby-identifier">file_url</span>
0
+236: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file_url</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r{^https?://}</span>
0
+237: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_url</span>)
0
 238:
0
-239: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">image_file</span> = <span class="ruby-identifier">file</span>
0
-240: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">file_url</span>.<span class="ruby-identifier">empty?</span>
0
-241: <span class="ruby-ivar">@missing_image</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@uploaded_image</span>
0
-242: <span class="ruby-keyword kw">else</span>
0
-243: <span class="ruby-ivar">@invalid_image</span> = <span class="ruby-keyword kw">true</span>
0
-244: <span class="ruby-keyword kw">end</span>
0
-245: <span class="ruby-keyword kw">end</span>
0
+239: <span class="ruby-comment cmt"># Force a URL based file to have an original_filename</span>
0
+240: <span class="ruby-identifier">eval</span> <span class="ruby-value str">&quot;class &lt;&lt; file\ndef original_filename\n\&quot;\#{file_url}\&quot;\nend\nend\n&quot;</span>
0
+241:
0
+242: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">image_file</span> = <span class="ruby-identifier">file</span>
0
+243: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">file_url</span>.<span class="ruby-identifier">empty?</span>
0
+244: <span class="ruby-ivar">@missing_image</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@uploaded_image</span>
0
+245: <span class="ruby-keyword kw">else</span>
0
+246: <span class="ruby-ivar">@invalid_image</span> = <span class="ruby-keyword kw">true</span>
0
+247: <span class="ruby-keyword kw">end</span>
0
+248: <span class="ruby-keyword kw">end</span>
0
 </pre>
0
           </div>
0
         </div>
0
@@ -420,14 +420,14 @@
0
             onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
0
           <div class="method-source-code" id="M000010-source">
0
 <pre>
0
- <span class="ruby-comment cmt"># File lib/fleximage/model.rb, line 274</span>
0
-274: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">operate</span>(<span class="ruby-operator">&amp;</span><s