jekyll-assets icon indicating copy to clipboard operation
jekyll-assets copied to clipboard

Auto-generate image width and height into html

Open axelson opened this issue 3 years ago • 0 comments

  • [x] This feature is not on the latest version

Request

I'd like to bring back something like [autoresize], it was first added in #116 but it appears to have been removed in https://github.com/envygeeks/jekyll-assets/commit/484880a337a1e16787a2ce2443cffe59862026f8

So using FastImage/ImageMagick, read out the file width and height, then insert that into the generated html.

Examples

I envision it working similar to:

{% asset mountains.jpg autosize=true responsive:automatic=true %}

This would generate html like:

<img src="/assets/e62518-7c6e59a6b1d1842b0abdcc30eb6bd1fa2d2eb6613fa226e1da209e17c96da356c25a9219431c207aa9aafe6be18852349838eb9d3c384d71d924e37586e8227e.jpg" srcset="/assets/2b8ae5-e8bf034164d498060726952ca8604a4ecd5a740c5a0687bf3171db0cee777516898b9aaf5e36f5015593c85da99391faacba5abd20a30d4dadf1d9df8b7b4276.jpg 2x" width="600" height="400">

axelson avatar Nov 19 '20 00:11 axelson