1
0
Fork 0
mirror of https://github.com/gohugoio/hugo.git synced 2025-04-27 07:43:12 +00:00
hugo/tpl
Tristan Rice a49f838cd0 tpl: Add imageConfig function
Add imageConfig function which calls image.DecodeConfig and returns the height, width and color mode of the image. ()

This allows for more advanced image shortcodes and templates such as those required by AMP.

layouts/shortcodes/amp-img.html
```
{{ $src := .Get "src" }}
{{ $config := imageConfig (printf "/static/%s" $src) }}

<amp-img src="{{$src}}"
           height="{{$config.Height}}"
           width="{{$config.Width}}"
           layout="responsive">
</amp-img>
```
2016-11-16 13:00:45 +01:00
..
reflect_helpers.go
template.go Make Amber read from the Afero source file system 2016-10-26 20:50:12 +02:00
template_embedded.go Revert the "standardize author data" 2016-09-18 19:16:39 +02:00
template_funcs.go tpl: Add imageConfig function 2016-11-16 13:00:45 +01:00
template_funcs_test.go tpl: Add imageConfig function 2016-11-16 13:00:45 +01:00
template_i18n.go commands, tpl: Get rid of repeating viper accesses 2016-11-07 00:10:32 +01:00
template_i18n_test.go tpl: Golint fixes 2016-11-05 17:28:14 +01:00
template_resources.go commands, tpl: Get rid of repeating viper accesses 2016-11-07 00:10:32 +01:00
template_resources_test.go all: Unify case of config variable names 2016-10-24 20:56:00 +02:00
template_test.go