Skip to content

Commit

Permalink
Fixed a bug that magic width and height columns would not reflect the…
Browse files Browse the repository at this point in the history
… attributes of an image that was resized with a preprocess_image operation
  • Loading branch information
AlexJWayne authored and dummied committed Jan 21, 2009
1 parent 55b7b11 commit 724fdc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/fleximage/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,14 @@ def post_save
def perform_preprocess_operation
if self.class.preprocess_image_operation
operate(&self.class.preprocess_image_operation)
set_magic_attributes #update width and height magic columns
@uploaded_image = @output_image
end
end

# If any magic column names exists fill them with image meta data.
def set_magic_attributes(file)
if self.respond_to?(:image_filename=)
def set_magic_attributes(file = nil)
if file && self.respond_to?(:image_filename=)
filename = file.original_filename if file.respond_to?(:original_filename)
filename = file.basename if file.respond_to?(:basename)
self.image_filename = filename
Expand Down
1 change: 0 additions & 1 deletion test/unit/magic_columns_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ def test_should_save_data_in_magic_columns_from_url
assert_equal 110, p.image_height
assert_equal 276, p.image_width
end

end

0 comments on commit 724fdc9

Please sign in to comment.