Improve the documentation of imageConfig and the image resource

- Added information about the expected argument type when calling
imageResource.
- Added a warning regarding calling imageConfig with incorrect arguments.
- Added information about two properties the `image` resource provides.

Co-authored-by: jmooring
This commit is contained in:
Nathan Lovatoandjmooring authored and Bjørn Erik Pedersen committed 2022-09-10 17:02:02 +02:00
1 parent 89aa723cc5
commit 4f0755683c
2 files changed
+7 -1

No files matched your search

@@ -28,7 +28,11 @@ content/
└── sunset.jpg <-- page resource └── sunset.jpg <-- page resource
``` ```
To access an image as a page resource: ## The Image Resource
The `image` resource gives you access to image-specific attributes like the picture's `Width` and `Height`, as well as powerful processing methods and filters. More on that below.
Note that the `image` resource can also be retrieved from a [global resource]({{< relref "/hugo-pipes/introduction#from-file-to-resource" >}})
```go-html-template ```go-html-template
{{ $image := .Resources.GetMatch "sunset.jpg" }} {{ $image := .Resources.GetMatch "sunset.jpg" }}
+2
View File
@@ -218,6 +218,8 @@ Also see the [Filter Method](/content-management/image-processing/#filter).
Parses the image and returns the height, width, and color model. Parses the image and returns the height, width, and color model.
The `imageConfig` function takes a single parameter, a file path (_string_) relative to the _project's root directory_, with or without a leading slash.
{{% funcsig %}} {{% funcsig %}}
images.ImageConfig PATH images.ImageConfig PATH
{{% /funcsig %}} {{% /funcsig %}}