Skip to content

Commit

Permalink
Merge branch '5' into 6
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 3, 2024
2 parents 0541b0e + db5980e commit d7f6b7e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions en/00_Getting_Started/00_Server_Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ You also need to install [Composer 2](https://getcomposer.org/).

## Database

We officially support and regression test against the LTS releases of MySQL and MariaDB, though we may choose to support additional versions on a case-by-case basis.
We officially support and regression test against the latest LTS releases of MySQL and MariaDB, though we may choose to support additional versions on a case-by-case basis.

- MySQL >=5.6 (built-in, [commercially supported](/project_governance/supported_modules/))
- MySQL >=5.6 and MariaDB (built-in, [commercially supported](/project_governance/supported_modules/))
- PostgreSQL ([third party module](https://github.com/silverstripe/silverstripe-postgresql), community
supported)
- SQL Server ([third party module](https://github.com/silverstripe/silverstripe-mssql), community supported)
Expand Down
13 changes: 13 additions & 0 deletions en/02_Developer_Guides/14_Files/02_Images.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,19 @@ SilverStripe\Core\Injector\Injector:

Manipulated images are stored as "file variants" in the same folder structure as the original image. The storage mechanism is described in the ["File Storage" guide](file_storage).

## Controlling how images are rendered

Developers can customise how `Image` instances are rendered on their website by overriding the `templates/SilverStripe/Assets/Storage/DBFile_Image.ss` template file.

This will apply to images added to an `HTMLEditorField` and images invoked in templates.

You can also choose to have different rendering logic for `HTMLEditorField` images and for images invoked in templates by overriding different templates.

- Add a `SilverStripe/Assets/Shortcodes/ImageShortcodeProvider_Image.ss` to your theme to control images added to an HTMLEditorField.
- Add a `DBFile_Image.ss` file to the root of your theme to control only images invoked in templates.

Look at [Template inheritance](../templates/Template_Inheritance) for more information on how to override SS templates.

## API documentation

- [File](api:SilverStripe\Assets\File)
Expand Down
21 changes: 21 additions & 0 deletions en/08_Changelogs/5.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ title: 5.3.0 (unreleased)

- [Features and enhancements](#features-and-enhancements)
- [High-level API for converting files](#file-converter)
- [Improve customisability of rendered images](#image-rendering)
- [Validation for elemental content blocks when saving individual blocks](#elemental-validation)
- [Define scaffolded form fields for relations to `DataObject` models](#scaffolded-relation-formfields)
- [Support for `JOIN` in SQL `UPDATE`](#sql-update-join)
Expand Down Expand Up @@ -52,6 +53,26 @@ Out of the box `silverstripe/assets` provides the new [`InterventionImageFileCon

See [convert a file to a different format](/developer_guides/files/file_manipulation/#file-conversion) for more details.

### Improve customisability of rendered images {#image-rendering}

We've aligned how images added to an [`HTMLEditorField`](api:SilverStripe\Forms\HTMLEditor\HTMLEditorField) and images invoked in templates are rendered. The markup up for both `<img>` tags are now generated from the same template file. This makes it easier to customise how images are rendered on your site.

The template for this is `templates/SilverStripe/Assets/Storage/DBFile_Image.ss`. Add a file with that path to your Silverstripe CMS theme if you want to override it.

This opens many interesting possibilities. For example, this code snippet will provide a WebP version of any image rendered on your site.

```html
<picture>
<source srcset="$Convert('webp').Link" type="image/webp">
<img $AttributesHTML >
</picture>
```

You can also choose to have different rendering logic for `HTMLEditorField` images and for images invoked in templates by overriding different templates.

- Add a `SilverStripe/Assets/Shortcodes/ImageShortcodeProvider_Image.ss` to your theme to control images added to an HTMLEditorField.
- Add a `DBFile_Image.ss` file to the root of your theme to control only images invoked in templates.

### Validation for inline-editable elemental content blocks {#elemental-validation}

Elemental content blocks now support validation when saving or publishing individual content blocks using the "three-dot" context menu in the top-right of the block.
Expand Down

0 comments on commit d7f6b7e

Please sign in to comment.