Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@ You can customize the views for each component, by changing the view in `resourc
<sup>†</sup> The _Embeds_ tool is triggered by pasting URLs to embeddable
content. It does not have an entry in the "Add" menu.

### Changing the image driver

You may change the image driver (default Imagick) via the configuration like so:

```php
return [
'toolSettings' => [
'image' => [
'imagedriver' => Spatie\Image\Enums\ImageDriver::Gd,
// ...
],
// ...
],
// ...
];
```

Any option set here must be of type `Spatie\Image\Enums\ImageDriver`.

### Registering custom components

Please refer to the [extending Nova EditorJS](./EXTENDING.md) guide on instructions on how to register custom
Expand Down
7 changes: 6 additions & 1 deletion src/Http/Controllers/EditorJsImageUploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ public function url(Request $request): JsonResponse
private function applyAlterations($path, $alterations = [])
{
try {
$image = Image::load($path);
if (! empty(config('nova-editor-js.toolSettings.image.imagedriver'))) {
$image = Image::useImageDriver(config('nova-editor-js.toolSettings.image.imagedriver'));
$image->loadFile($path);
} else {
$image = Image::load($path);
}

$imageSettings = config('nova-editor-js.toolSettings.image.alterations');

Expand Down
1 change: 1 addition & 0 deletions src/config/nova-editor-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'shortcut' => 'CMD+SHIFT+I',
'path' => 'public/images',
'disk' => 'local',
'imagedriver' => Spatie\Image\Enums\ImageDriver::Imagick,
'alterations' => [
'resize' => [
'width' => false, // integer
Expand Down
Loading