Update resize_image docs

This commit is contained in:
Vincent Prouillet 2021-06-11 23:39:48 +02:00
parent 1bf5cd7bf8
commit c0a0df4fe9
2 changed files with 18 additions and 3 deletions

View file

@ -19,6 +19,7 @@
search in $BASE_DIR + $path, $BASE_DIR + static + $path and $BASE_DIR + content + $path search in $BASE_DIR + $path, $BASE_DIR + static + $path and $BASE_DIR + content + $path
3. `get_file_hash` now returns base64 encoded hash by default 3. `get_file_hash` now returns base64 encoded hash by default
4. all functions working on files can now only load files in the Zola directory 4. all functions working on files can now only load files in the Zola directory
5. `resize_image` return value has changed
### Other ### Other

View file

@ -44,10 +44,24 @@ static/processed_images/
The filename of each resized image is a hash of the function arguments, The filename of each resized image is a hash of the function arguments,
which means that once an image is resized in a certain way, it will be stored in the above directory and will not which means that once an image is resized in a certain way, it will be stored in the above directory and will not
need to be resized again during subsequent builds (unless the image itself, the dimensions, or other arguments are changed). need to be resized again during subsequent builds (unless the image itself, the dimensions, or other arguments have changed).
Therefore, if you have a large number of images, they will only need to be resized once.
The function returns a full URL to the resized image. The function returns an object with the following schema:
```
/// The final URL for that asset
url: String,
/// The path to the static asset generated
static_path: String,
/// New image width
width: u32,
/// New image height
height: u32,
/// Original image width
orig_width: u32,
/// Original image height
orig_height: u32,
```
## Resize operations ## Resize operations