Commit d458eeb4 authored by Jan-Philipp Stauffert's avatar Jan-Philipp Stauffert
Browse files

Fix aspect ratio calculation

parent 5213b243
PATH
remote: .
specs:
jekyll-img-srcset (0.1.0)
jekyll (~> 4.0)
mini_magick
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
ffi (1.11.3)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
jekyll (4.0.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (>= 0.9.5, < 2)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-sass-converter (2.0.1)
sassc (> 2.0.1, < 3.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.1.0)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mini_magick (4.9.5)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.1)
rake (12.3.3)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rouge (3.13.0)
safe_yaml (1.0.5)
sassc (2.2.1)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.6.0)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.16)
jekyll-img-srcset!
rake (~> 12.0)
BUNDLED WITH
1.17.2
......@@ -3,7 +3,7 @@ require 'mini_magick'
def resize_image(url, widths, dest, base_image_path)
image = MiniMagick::Image.open(File.join(base_image_path, url))
w = image.dimensions[0]
aspect = image.dimensions[1] / w
aspect = image.dimensions[1].to_f / w
new_widths = widths.select {|x| x <= w}
new_widths.map do |width|
[width, File.join(dest, base_image_path, "#{width}", url)]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment