You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/02_Developer_Guides/14_Files/02_Images.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -318,16 +318,19 @@ SilverStripe\Assets\Image:
318
318
lazy_loading_enabled: false
319
319
```
320
320
321
-
## Changing the manipulation driver to imagick
321
+
## Changing the manipulation driver {#intervention-image-driver}
322
322
323
-
If you want to change the image manipulation driver to use Imagick instead of GD, you'll need to change your config so
324
-
that the `Intervention\Image\ImageManager` is instantiated with the `imagick` driver instead of GD:
323
+
If you have the [imagick PHP extension](https://www.php.net/manual/en/book.imagick.php) installed, it will be used as the driver for `intervention/image` by default. If you don't, the assumption is that you have the [GD PHP extension](https://www.php.net/manual/en/book.image.php) installed, and it will be used instead.
324
+
325
+
If you want to change the image manipulation driver to something else (either a third-party driver, or else use GD even when imagick is installed), you need to configure that via the injector:
Copy file name to clipboardExpand all lines: en/02_Developer_Guides/14_Files/05_File_Manipulation.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,7 +209,7 @@ This can be very useful if you want to convert a file to a different format for
209
209
210
210
#### Making our own `FileConverter`
211
211
212
-
Converting between image formats is the easiest example, because we can let [Intervention Image](https://image.intervention.io/v2) do the heavy lifting for us. Note that there is a built in [`InterventionImageFileConverter`](api:SilverStripe\Assets\Conversion\InterventionImageFileConverter) class which does this already, but we'll use this as an example for how to create our own `FileConverter`.
212
+
Converting between image formats is the easiest example, because we can let [Intervention Image](https://image.intervention.io/v3) do the heavy lifting for us. Note that there is a built in [`InterventionImageFileConverter`](api:SilverStripe\Assets\Conversion\InterventionImageFileConverter) class which does this already, but we'll use this as an example for how to create our own `FileConverter`.
213
213
214
214
The `FileConverter` interface requires us to implement two methods:
215
215
@@ -219,7 +219,7 @@ The `FileConverter` interface requires us to implement two methods:
219
219
```php
220
220
namespace App\Conversion;
221
221
222
-
use Intervention\Image\Exception\ImageException;
222
+
use Intervention\Image\Exceptions\RuntimeException;
223
223
use SilverStripe\Assets\Conversion\FileConverter;
224
224
use SilverStripe\Assets\Conversion\FileConverterException;
225
225
use SilverStripe\Assets\File;
@@ -248,7 +248,7 @@ class ImageFileConverter implements FileConverter
248
248
return [$tuple, $backend];
249
249
}
250
250
);
251
-
} catch (ImageException $e) {
251
+
} catch (RuntimeException $e) {
252
252
throw new FileConverterException('Failed to convert: ' . $e->getMessage(), $e->getCode(), $e);
253
253
}
254
254
}
@@ -320,7 +320,7 @@ Our callback returns both the information about the variant file and the `Image_
320
320
```php
321
321
try {
322
322
// ...
323
-
} catch (ImageException $e) {
323
+
} catch (RuntimeException $e) {
324
324
throw new FileConverterException('Failed to convert: ' . $e->getMessage(), $e->getCode(), $e);
Copy file name to clipboardExpand all lines: en/08_Changelogs/6.0.0.md
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ title: 6.0.0 (unreleased)
10
10
-[Run `CanonicalURLMiddleware` in all environments by default](#url-middleware)
11
11
-[Changes to scaffolded form fields](#scaffolded-fields)
12
12
-[Other new features](#other-new-features)
13
+
-[Dependency changes](#dependency-changes)
14
+
-[`intervention/image` has been upgraded from v2 to v3](#intervention-image)
13
15
-[Bug fixes](#bug-fixes)
14
16
-[API changes](#api-changes)
15
17
-[Most extension hook methods are now protected](#hooks-protected)
@@ -58,6 +60,57 @@ All other models used `SearchableDropdownField` for `has_one` relations and `Gri
58
60
- Native indexed PHP arrays can now be passed into templates and iterated over with `<% loop $MyArray %>`. Under the hood they are wrapped in [`ArrayList`](api:SilverStripe\View\ViewableData), so you can get the count using `$Count` and use `<% if $ArrayList %>` as a shortcut for `<% if $ArrayList.Count %>`. Other functionality from `ArrayList` such as filtering and sorting cannot be used on arrays since they don't have keys to filter or sort against.
59
61
- Modules no longer need to have a root level `_config.php` or `_config` directory to be recognised as a Silverstripe CMS module. They will now be recognised as a module if they have a `composer.json` file with a `type` of `silverstripe-vendormodule` or `silverstripe-theme`.
60
62
63
+
## Dependency changes
64
+
65
+
### `intervention/image` has been upgraded from v2 to v3 {#intervention-image}
66
+
67
+
We've upgraded from `intervention/image` v2 to v3. One of the main improvements included in this upgrade is full support for animated GIFs.
68
+
69
+
If you are directly interacting with APIs from `intervention/image` in your project or module you should check out [their upgrade guide](https://image.intervention.io/v3/introduction/upgrade).
70
+
71
+
#### Animated vs still images {#intervention-image-animations}
72
+
73
+
Manipulating animated images takes longer, and results in a larger filesize.
74
+
75
+
Because of this, the [`ThumbnailGenerator`](api:SilverStripe\AssetAdmin\Model\ThumbnailGenerator) will provide still images as thumbnails for animated gifs by default. You can change that for a given instance of `ThumbnailGenerator` by passing `true` to the [`setAllowsAnimation()`](api:SilverStripe\AssetAdmin\Model\ThumbnailGenerator::setAllowsAnimation()) method. For example, to allow animated thumbnails for `UploadField`:
When manipulating images yourself, you can use the new [`RemoveAnimation()`](api:SilverStripe\Assets\ImageManipulation::RemoveAnimation()) method before your resizing methods:
88
+
89
+
```ss
90
+
$MyImage.RemoveAnimation.FitMax(300, 200)
91
+
```
92
+
93
+
If the image isn't animated `RemoveAnimation()` will just return the original image without generating a variant, so it's safe to use without first checking if the image is animated.
94
+
95
+
#### Using GD or Imagick {#intervention-image-driver}
96
+
97
+
One of the changes that comes as a result of this upgrade is a change in how you configure which manipulation driver (GD or Imagick) to use.
98
+
99
+
To facilitate upgrades and to ensure we are providing optimal defaults out of the box, if you have the [imagick PHP extension](https://www.php.net/manual/en/book.imagick.php) installed, it will be used as the driver for `intervention/image` by default. If you don't, the assumption is that you have the [GD PHP extension](https://www.php.net/manual/en/book.image.php) installed, and it will be used instead.
100
+
101
+
See [changing the manipulation driver](/developer_guides/files/images/#intervention-image-driver) for the new configuration for swapping the driver used by `intervention/image`.
102
+
103
+
#### New API {#intervention-image-new-api}
104
+
105
+
The following new methods have been added to facilitate this upgrade:
106
+
107
+
|Method name|Where the method was added|
108
+
|---|---|
109
+
|`getIsAnimated()`|[`AssetContainer::getIsAnimated()`](api:SilverStripe\Assets\Storage\AssetContainer::getIsAnimated()), [`ImageManipulation::getIsAnimated()`](api:SilverStripe\Assets\ImageManipulation::getIsAnimated()) (and therefore `DBFile`, `File`, and their subclasses), [`Image_Backend::getIsAnimated()`](api:SilverStripe\Assets\Image_Backend::getIsAnimated()), [`InterventionBackend::getIsAnimated()`](api:SilverStripe\Assets\InterventionBackend::getIsAnimated())|
110
+
|`RemoveAnimation()`|[`ImageManipulation::RemoveAnimation()`](api:SilverStripe\Assets\ImageManipulation::RemoveAnimation()) (and therefore `DBFile`, `File`, and their subclasses), [`Image_Backend::removeAnimation()`](api:SilverStripe\Assets\Image_Backend::removeAnimation()), [`InterventionBackend::removeAnimation()`](api:SilverStripe\Assets\InterventionBackend::removeAnimation())|
This release includes a number of bug fixes to improve a broad range of areas. Check the change logs for full details of these fixes split by module. Thank you to the community members that helped contribute these fixes as part of the release!
0 commit comments