Skip to content

Commit

Permalink
Revert "Adding Attachment#geometry to get file's dimension"
Browse files Browse the repository at this point in the history
It's not working correctly as expected, so let's revert this for now.

This reverts commit 51bb0f9.
  • Loading branch information
sikachu committed Mar 30, 2012
1 parent d61ddd5 commit b8f061c
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 195 deletions.
5 changes: 0 additions & 5 deletions lib/paperclip/attachment.rb
Expand Up @@ -319,11 +319,6 @@ def instance_read(attr)
instance.send(getter) if responds || attr.to_s == "file_name"
end

# Returns a geometry object which you can get the image's dimension.
def geometry(style = :original)
Geometry.from_file(path(style))
end

private

def path_option
Expand Down
5 changes: 0 additions & 5 deletions lib/paperclip/geometry.rb
Expand Up @@ -11,11 +11,6 @@ def initialize width = nil, height = nil, modifier = nil
@modifier = modifier
end

# Returns the equality based on height, width, and modifier
def ==(other)
height == other.height && width == other.width && modifier == other.modifier
end

# Uses ImageMagick to determing the dimensions of a file, passed in as either a
# File or path.
# NOTE: (race cond) Do not reassign the 'file' variable inside this method as it is likely to be
Expand Down
15 changes: 0 additions & 15 deletions test/attachment_test.rb
Expand Up @@ -1158,19 +1158,4 @@ def do_after_all; end
end
end

context "attachment's geometry" do
setup do
rebuild_model
@dummy = Dummy.new
@file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb')
@dummy.avatar = @file
@dummy.save!
@attachment = @dummy.avatar
@geometry = Paperclip::Geometry.from_file(@file.path)
end

should "return a correct geometry object" do
assert_equal @geometry, @attachment.geometry
end
end
end

0 comments on commit b8f061c

Please sign in to comment.