From 12ec4f951e0983f50d055fab686dde456e4e412d Mon Sep 17 00:00:00 2001 From: Eddo Kloosterman Date: Thu, 2 Feb 2017 22:09:16 +0100 Subject: [PATCH] Fixed the bug about creating the scaled images, as mentioned in issue #5 in the original jekyll-srcset repository --- lib/jekyll/srcset/tag.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/srcset/tag.rb b/lib/jekyll/srcset/tag.rb index 9785965..590de6b 100644 --- a/lib/jekyll/srcset/tag.rb +++ b/lib/jekyll/srcset/tag.rb @@ -87,7 +87,9 @@ def generate_image(site, src, attrs) img_attrs["height"] = attrs["height"] if attrs["height"] img_attrs["width"] = attrs["width"] if attrs["width"] - img_attrs["src"] = src.sub(/(\.\w+)$/, "-#{img.columns}x#{img.rows}" + '\1') + img_width = img.columns * scale + img_height = img.rows * scale + img_attrs["src"] = src.sub(/(\.\w+)$/, "-" + (img_width.to_int.to_s) + "x" + (img_height.to_int.to_s) + '\1') filename = img_attrs["src"].sub(/^\//, '') dest = File.join(site.dest, filename)