mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
---
|
||||
title: Image Filters
|
||||
description: The images namespace provides a list of filters and other image related functions.
|
||||
date: 2017-02-01
|
||||
categories: [functions]
|
||||
aliases: [/functions/imageconfig/]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
parent: functions
|
||||
keywords: [images]
|
||||
toc: true
|
||||
---
|
||||
@@ -46,7 +45,7 @@ images.Text TEXT DICT)
|
||||
The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
|
||||
|
||||
```go-html-template
|
||||
{{ $img := resources.Get "/images/background.png"}}
|
||||
{{ $img := resources.Get "/images/background.png" }}
|
||||
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
|
||||
"color" "#ffffff"
|
||||
"size" 60
|
||||
@@ -61,7 +60,7 @@ You can load a custom font if needed. Load the font as a Hugo `Resource` and set
|
||||
```go-html-template
|
||||
|
||||
{{ $font := resources.GetRemote "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Black.ttf" }}
|
||||
{{ $img := resources.Get "/images/background.png"}}
|
||||
{{ $img := resources.Get "/images/background.png" }}
|
||||
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
|
||||
"font" $font
|
||||
))}}
|
||||
@@ -222,6 +221,6 @@ images.ImageConfig PATH
|
||||
|
||||
```go-html-template
|
||||
{{ with (imageConfig "favicon.ico") }}
|
||||
favicon.ico: {{.Width}} x {{.Height}}
|
||||
favicon.ico: {{ .Width }} x {{ .Height }}
|
||||
{{ end }}
|
||||
```
|
||||
|
Reference in New Issue
Block a user