robwierzbowski / jekyll-image-tag

Better images for Jekyll.
BSD 3-Clause "New" or "Revised" License
98 stars 26 forks source link

resizing of image broken when fixed width #2

Closed snrbrnjna closed 11 years ago

snrbrnjna commented 11 years ago

here's my patch:

--- a/_plugins/image_tag.rb
+++ b/_plugins/image_tag.rb
@@ -121,7 +121,7 @@ module Jekyll
       gen_height = if preset[:height]
         preset[:height].to_f
       elsif preset[:width]
-        orig_ratio * preset[:width].to_f
+        preset[:width].to_f / orig_ratio
       else
         orig_height
       end

the same phenomenon on picture_tag

robwierzbowski commented 11 years ago

Sorry, I broke that accidentally a few commits ago, but it should be fixed in the latest github release.

https://github.com/robwierzbowski/jekyll-image-tag/blob/master/image_tag.rb#L120

I should really write some tests to prevent this type of regression.