Support quality parameter in resize functionality.
Chris Dyer
committed Aug 31, 2016
commit 5e98f35eaaa00544c5f4cf657ce6890fcc07317c
Showing 1
changed file with
5 additions
and 1 deletions
locomotive/steam/services/image_resizer_service.rb b/lib/locomotive/steam/services/image_resizer_service.rb
+5
-1
| @@ | @@ -9,7 +9,11 @@ module Locomotive |
| return get_url_or_path(source) if disabled? || geometry.blank? | |
| if file = fetch_file(source) | |
| - | file.thumb(geometry).url |
| + | /(?<size>[^q]*)(?:q(?<quality>\d+))?/ =~ geometry |
| + | |
| + | transformed_file = file.thumb(size) |
| + | transformed_file = transformed_file.convert("-auto-orient -quality #{quality}") if quality.present? |
| + | transformed_file.url |
| else | |
| Locomotive::Common::Logger.error "Unable to resize on the fly: #{source.inspect}" | |
| nil | |