images: Fix cache busting of image text filter

See #9238
This commit is contained in:
Bjørn Erik Pedersen 2021-12-07 11:48:48 +01:00
parent 6c3bc5ebad
commit e61cdf335f
15 changed files with 3 additions and 4 deletions

View file

@ -676,7 +676,7 @@ func TestImageOperationsGolden(t *testing.T) {
f.Overlay(gopher.(images.ImageSource), 20, 30), f.Overlay(gopher.(images.ImageSource), 20, 30),
f.Text("No options"), f.Text("No options"),
f.Text("This long text is to test line breaks. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."), f.Text("This long text is to test line breaks. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."),
f.Text("Hugo rocks!", map[string]interface{}{"x": 30, "y": 30, "size": 15, "color": "#ff0000"}), f.Text("Hugo rocks!", map[string]interface{}{"x": 3, "y": 3, "size": 20, "color": "#fc03b1"}),
} }
resized, err := orig.Fill("400x200 center") resized, err := orig.Fill("400x200 center")

View file

@ -46,9 +46,9 @@ func (*Filters) Text(text string, options ...interface{}) gift.Filter {
linespacing: 2, linespacing: 2,
} }
var opt map[string]interface{} var opt maps.Params
if len(options) > 0 { if len(options) > 0 {
opt := maps.MustToParamsAndPrepare(options[0]) opt = maps.MustToParamsAndPrepare(options[0])
for option, v := range opt { for option, v := range opt {
switch option { switch option {
case "color": case "color":
@ -62,7 +62,6 @@ func (*Filters) Text(text string, options ...interface{}) gift.Filter {
case "linespacing": case "linespacing":
tf.linespacing = cast.ToInt(v) tf.linespacing = cast.ToInt(v)
} }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB