diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-02-03 16:47:35 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-02-05 13:59:15 +0100 |
commit | 722086b4ed3e77d1aba6724474bec06d08e7de06 (patch) | |
tree | 470bd91123d6de0f7a38ca40ec18a4d4835d9f8c /resource/testhelpers_test.go | |
parent | 084cf4191b3c1e7590a4223fd9251019ef5d4c21 (diff) |
resource: Add smart cropping
This commit `smart` as a new and default anchor in `Fill`.
So:
```html
{{ $image.Fill "200x200" }}
```
Is, with default configuration, the same as:
```html
{{ $image.Fill "200x200" "smart" }}
```
You can change this default in your `config.toml`:
```toml
[imaging]
[imaging]
resampleFilter = "box"
quality = 68
anchor = "Smart"
```
Fixes #4375
Diffstat (limited to 'resource/testhelpers_test.go')
-rw-r--r-- | resource/testhelpers_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/resource/testhelpers_test.go b/resource/testhelpers_test.go index 03a6d6134..2b543ab64 100644 --- a/resource/testhelpers_test.go +++ b/resource/testhelpers_test.go @@ -25,6 +25,15 @@ func newTestResourceSpecForBaseURL(assert *require.Assertions, baseURL string) * cfg := viper.New() cfg.Set("baseURL", baseURL) cfg.Set("resourceDir", "/res") + + imagingCfg := map[string]interface{}{ + "resampleFilter": "linear", + "quality": 68, + "anchor": "left", + } + + cfg.Set("imaging", imagingCfg) + fs := hugofs.NewMem(cfg) s, err := helpers.NewPathSpec(fs, cfg) |