-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add #width
and #height
methods to the RMagick processor
#1805
Add #width
and #height
methods to the RMagick processor
#1805
Conversation
@@ -351,5 +373,9 @@ def destroy_image(image) | |||
image.destroy! if image.respond_to?(:destroy!) | |||
end | |||
|
|||
def rmagick_image | |||
::Magick::Image.ping(current_path).first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used ping
instead of read
as we are interested in the image metadata, but don't care about the pixel data.
Ref http://www.rubydoc.info/gems/rmagick/2.15.4/Magick/Image#ping-class_method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little concerned about this. Calling ping
will return an image with invalid pixel data, and naming this rmagick_image
seems to be asking for trouble.
Either we need to read the entire image, or we should rename the method.
I'm happy with this change in concept, but I've noted one concern above. |
This keeps the symmetry with MiniMagick processor where `#width` and `#height` methods has been introduced by carrierwaveuploader#1405.
This was introduced by a bad merge of carrierwaveuploader#1804 and carrierwaveuploader#1806 which both were based on master and added the `private` keyword for two different methods.
ca296b6
to
9a73434
Compare
@thomasfedb I agree 👍. I fixed it by using |
Add `#width` and `#height` methods to the RMagick processor
Thanks @mehlah! |
This keeps the symmetry with MiniMagick processor where
#width
and#height
methods has been introduced by #1405.