-
Notifications
You must be signed in to change notification settings - Fork 0
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
Handle resize_to_limit and saver.quality to be compatible with MiniMagick and Vips #7
base: main
Are you sure you want to change the base?
Conversation
lib/kamifusen/processor.rb
Outdated
url = "#{Kamifusen.keycdn}/#{variant.blob.key}?" | ||
url += "format=#{transformations[:format]}&" if transformations.has_key? :format | ||
|
||
width = get_resize_width |
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.
Il vaudrait mieux un lazy load
lib/kamifusen/processor.rb
Outdated
width = get_resize_width | ||
url += "width=#{width}" unless width.nil? | ||
|
||
quality = get_quality |
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.
idem lazy load
lib/kamifusen/processor.rb
Outdated
transformations.dig(:saver, :quality) | ||
end | ||
|
||
def get_resize_width |
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.
resize_width, lazy
lib/kamifusen/processor.rb
Outdated
@transformations ||= variant.variation.transformations | ||
end | ||
|
||
def get_quality |
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.
quality, lazy
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.
On peut rendre le code encore plus élégant avec des lazy loaders sans get
Modifications apportées
keycdn_url
processeur :variant(resize: "400>")
etvariant(quality: 80)
au profit devariant(resize_to_limit: [400, nil])
etvariant(saver: { quality: 80 })