mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Add $image.Process
Which supports all the existing actions: resize, crop, fit, fill. But it also allows plain format conversions: ``` {{ $img = $img.Process "webp" }} ``` Which will be a simple re-encoding of the source image. Fixes #11483
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
package page
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
@@ -23,8 +24,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"errors"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hstrings"
|
||||
"github.com/gohugoio/hugo/common/maps"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/resources/kinds"
|
||||
@@ -396,7 +396,6 @@ func (l PermalinkExpander) toSliceFunc(cut string) func(s []string) []string {
|
||||
}
|
||||
return s[n1:n2]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var permalinksKindsSupport = []string{kinds.KindPage, kinds.KindSection, kinds.KindTaxonomy, kinds.KindTerm}
|
||||
@@ -425,7 +424,7 @@ func DecodePermalinksConfig(m map[string]any) (map[string]map[string]string, err
|
||||
// [permalinks.key]
|
||||
// xyz = ???
|
||||
|
||||
if helpers.InStringArray(permalinksKindsSupport, k) {
|
||||
if hstrings.InSlice(permalinksKindsSupport, k) {
|
||||
// TODO: warn if we overwrite an already set value
|
||||
for k2, v2 := range v {
|
||||
switch v2 := v2.(type) {
|
||||
|
Reference in New Issue
Block a user