From b6d12bc1440df7d08fad1cfeed9056682679f742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kiste?= Date: Fri, 25 Jun 2021 15:37:28 +1200 Subject: [PATCH 1/3] Add docs for lazy loading --- docs/en/02_Developer_Guides/14_Files/02_Images.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/en/02_Developer_Guides/14_Files/02_Images.md b/docs/en/02_Developer_Guides/14_Files/02_Images.md index 6b9d60ec5..f2110c216 100644 --- a/docs/en/02_Developer_Guides/14_Files/02_Images.md +++ b/docs/en/02_Developer_Guides/14_Files/02_Images.md @@ -200,6 +200,19 @@ SilverStripe\Core\Injector\Injector: Quality: 90 ``` +### Lazy Loading + +Images added via the WYSIWYG editor and as objects on templates are [lazy loaded](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading) by default. + +To disable lazy loading for an individual image, you can call `$MyImage.setLazyLoad(false)`. + +You can opt out of lazy loading globally by setting the `Image::lazy_loading_enabled` config to `false`, see example `yml`: + +```yml +SilverStripe\Assets\Image: + lazy_loading_enabled: false +``` + ## Changing the manipulation driver to Imagick If you want to change the image manipulation driver to use Imagick instead of GD, you'll need to change your config so From 8225b2e890e752f593ba1285bed05c0ed4816943 Mon Sep 17 00:00:00 2001 From: Andre Kiste Date: Fri, 2 Jul 2021 11:34:18 +1200 Subject: [PATCH 2/3] Update 02_Images.md --- docs/en/02_Developer_Guides/14_Files/02_Images.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/02_Developer_Guides/14_Files/02_Images.md b/docs/en/02_Developer_Guides/14_Files/02_Images.md index f2110c216..c64f02774 100644 --- a/docs/en/02_Developer_Guides/14_Files/02_Images.md +++ b/docs/en/02_Developer_Guides/14_Files/02_Images.md @@ -204,7 +204,7 @@ SilverStripe\Core\Injector\Injector: Images added via the WYSIWYG editor and as objects on templates are [lazy loaded](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading) by default. -To disable lazy loading for an individual image, you can call `$MyImage.setLazyLoad(false)`. +To disable lazy loading for an individual image, you can call `$MyImage.setLazyLoad(0)`. You can opt out of lazy loading globally by setting the `Image::lazy_loading_enabled` config to `false`, see example `yml`: From 03b43227a5b484bcc3a9eac8340c73a28477e664 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 9 Jul 2021 10:03:44 +1200 Subject: [PATCH 3/3] Update 02_Images.md --- docs/en/02_Developer_Guides/14_Files/02_Images.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/02_Developer_Guides/14_Files/02_Images.md b/docs/en/02_Developer_Guides/14_Files/02_Images.md index c64f02774..279c345bc 100644 --- a/docs/en/02_Developer_Guides/14_Files/02_Images.md +++ b/docs/en/02_Developer_Guides/14_Files/02_Images.md @@ -204,7 +204,7 @@ SilverStripe\Core\Injector\Injector: Images added via the WYSIWYG editor and as objects on templates are [lazy loaded](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading) by default. -To disable lazy loading for an individual image, you can call `$MyImage.setLazyLoad(0)`. +To disable lazy loading for an individual image with a template, you can call `$MyImage.LazyLoad(false)`. You can opt out of lazy loading globally by setting the `Image::lazy_loading_enabled` config to `false`, see example `yml`: