enables the use of a custom Liquid tag {% aspectratio filepath %}, to find the aspect ratio of an image or video file.
# via ruby-gems
- gem install jekyll-aspect-ratio
# or via bundler
- bundle add jekyll-aspect-ratio
Add the gem to your plugins inside _config.yml:
plugins:
- jekyll-aspect-ratio
This plugin uses , so supports all
. This means it's capable of handling both videos and images.
{% assign filepath = "assets/media/2020-05-10/image1.jpg" }
{% aspectratio filepath %} >>> 1.33
{% aspectratio "assets/media/2020-05-10/image2.jpg" } >>> 0.56
{% aspectratio /assets/media/2020-05-10/video1.mp4 } >>> 1.77
{% aspectratio "assets/media/2020-05-10/not-a-real-file.jpg" } >>> 0