Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
HCI-Development
Jekyll Img Srcset
Commits
d458eeb4
Commit
d458eeb4
authored
Dec 17, 2019
by
Jan-Philipp Stauffert
Browse files
Fix aspect ratio calculation
parent
5213b243
Changes
2
Hide whitespace changes
Inline
Side-by-side
Gemfile.lock
0 → 100644
View file @
d458eeb4
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
lib/jekyll-img-srcset.rb
View file @
d458eeb4
...
...
@@ -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
)]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment