File tree 6 files changed +54
-2
lines changed
6 files changed +54
-2
lines changed Original file line number Diff line number Diff line change 73
73
74
74
'image-naming-method ' => 'hash-file ' ,
75
75
76
+ /*
77
+ |--------------------------------------------------------------------------
78
+ | Image Processing Library
79
+ |--------------------------------------------------------------------------
80
+ |
81
+ |
82
+ | Available methods: GD, IMAGICK
83
+ |
84
+ */
85
+
86
+ 'image-processing-library ' => \Mostafaznv \NovaCkEditor \Enums \ImageLibrary::GD ,
87
+
76
88
/*
77
89
|--------------------------------------------------------------------------
78
90
| Naming Method of Audio
Original file line number Diff line number Diff line change 45
45
* [ Image Max Width] ( advanced-usage/configuration/image-max-width.md )
46
46
* [ Image Max Height] ( advanced-usage/configuration/image-max-height.md )
47
47
* [ Image Naming Method] ( advanced-usage/configuration/image-naming-method.md )
48
+ * [ Image Processing Library] ( advanced-usage/configuration/image-processing-library.md )
48
49
* [ Audio Naming Method] ( advanced-usage/configuration/audio-naming-method.md )
49
50
* [ File Naming Method] ( advanced-usage/configuration/audio-naming-method-1.md )
50
51
* [ Toolbars] ( advanced-usage/configuration/toolbars/README.md )
Original file line number Diff line number Diff line change @@ -4,4 +4,3 @@ This section will guide you through the various methods and options available fo
4
4
5
5
Let's dive into the comprehensive set of features and functionalities offered by the CKEditor field in the following sections.
6
6
7
- \
Original file line number Diff line number Diff line change
1
+ ---
2
+ description : image-processing-library
3
+ ---
4
+
5
+ # Image Processing Library
6
+
7
+ | Property Name | Type | Default |
8
+ | ------------------------ | ------------ | ------------------------------------ |
9
+ | image-processing-library | ImageLibrary | <mark style =" color :red ;" >` GD ` </mark > |
10
+
11
+
12
+
13
+ This configuration option allows you to define the image processing library that will be used for handling image operations in the NovaCkEditor package.
14
+
15
+
16
+
17
+ ** Available Methods:**
18
+
19
+ * <mark style =" color :red ;" >GD</mark >: A lightweight and widely-supported image processing library.
20
+ * <mark style =" color :red ;" >IMAGICK</mark >: A more advanced library with additional features for image manipulation.
21
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Mostafaznv \NovaCkEditor \Enums ;
4
+
5
+
6
+ enum ImageLibrary: string
7
+ {
8
+ case GD = 'GD ' ;
9
+ case IMAGICK = 'IMAGICK ' ;
10
+ }
Original file line number Diff line number Diff line change 5
5
use Illuminate \Http \UploadedFile ;
6
6
use Intervention \Image \ImageManager ;
7
7
use Intervention \Image \Interfaces \ImageInterface ;
8
+ use Mostafaznv \NovaCkEditor \Enums \ImageLibrary ;
8
9
use Spatie \ImageOptimizer \OptimizerChainFactory ;
9
10
10
11
11
12
class ImageStorage extends Storage
12
13
{
14
+ protected ImageLibrary $ library ;
15
+
16
+
13
17
public function __construct (string $ disk = 'image ' )
14
18
{
15
19
parent ::__construct ($ disk );
16
20
17
21
$ this ->namingMethod = config ('nova-ckeditor.image-naming-method ' );
22
+ $ this ->library = config ('nova-ckeditor.image-processing-library ' , ImageLibrary::GD );
18
23
}
19
24
20
25
public static function make (string $ disk = 'image ' ): self
@@ -72,7 +77,11 @@ protected function resize(UploadedFile $file): array
72
77
73
78
protected function resizeImage (UploadedFile $ file , int $ maxWidth , int $ maxHeight ): ImageInterface
74
79
{
75
- $ image = ImageManager::gd ()->read ($ file ->getRealPath ());
80
+ $ manager = $ this ->library == ImageLibrary::GD
81
+ ? ImageManager::gd ()
82
+ : ImageManager::imagick ();
83
+
84
+ $ image = $ manager ->read ($ file ->getRealPath ());
76
85
77
86
return $ image ->scaleDown ($ maxWidth , $ maxHeight );
78
87
}
You can’t perform that action at this time.
0 commit comments