Skip to content

Commit 09f26e7

Browse files
committed
Admin > Summernote editördeki resim yükleme işlemi Laravel-FileManager ile yapıldı.
- composer require unisharp/laravel-filemanager php artisan vendor:publish --tag=lfm_config php artisan vendor:publish --tag=lfm_public - File Manager Admin: UniSharp/laravel-filemanager#1019
1 parent 952761c commit 09f26e7

32 files changed

+2072
-9
lines changed

docker/php8/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ RUN docker-php-ext-install fileinfo
1414
RUN docker-php-ext-install pdo
1515
RUN docker-php-ext-install pdo_mysql
1616
#RUN docker-php-ext-install tokenizer
17+
RUN docker-php-ext-install exif
18+
RUN apt-get update && \
19+
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \
20+
docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \
21+
docker-php-ext-install gd
1722

1823
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
1924

project/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"laravel/framework": "^10.10",
1111
"laravel/sanctum": "^3.2",
1212
"laravel/tinker": "^2.8",
13-
"realrashid/sweet-alert": "^7.1"
13+
"realrashid/sweet-alert": "^7.1",
14+
"unisharp/laravel-filemanager": "^2.6"
1415
},
1516
"require-dev": {
1617
"fakerphp/faker": "^1.9.1",

project/config/app.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184

185185
'aliases' => Facade::defaultAliases()->merge([
186186
// 'Example' => App\Facades\Example::class,
187-
'Alert' => RealRashid\SweetAlert\Facades\Alert::class
187+
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
188+
'Image' => Intervention\Image\Facades\Image::class
188189
])->toArray(),
189190

190191
];

project/config/lfm.php

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Documentation for this config :
6+
|--------------------------------------------------------------------------
7+
| online => http://unisharp.github.io/laravel-filemanager/config
8+
| offline => vendor/unisharp/laravel-filemanager/docs/config.md
9+
*/
10+
11+
return [
12+
/*
13+
|--------------------------------------------------------------------------
14+
| Routing
15+
|--------------------------------------------------------------------------
16+
*/
17+
18+
'use_package_routes' => true,
19+
20+
/**
21+
* \UniSharp\LaravelFilemanager\LaravelFilemanagerServiceProvider::boot metodu içerisinde;
22+
* if (config('lfm.use_package_routes')) {
23+
* Route::group(['prefix' => config('lfm.prefix') ?: 'filemanger', config('lfm.middlewares') ?: ['web','auth']], function () {
24+
* \UniSharp\LaravelFilemanager\Lfm::routes();
25+
* });
26+
* }
27+
* şeklinde değişiklik yapıldıktan sonra aşağıdaki middlewares ve prefix ayarları geçerli olacaktır.
28+
*/
29+
30+
/**
31+
* Customize middlewares when use use_package_routes
32+
*/
33+
'middlewares' => ['admin', 'auth:admin'],
34+
35+
/**
36+
* Customize prefix when use use_package_routes
37+
*/
38+
'prefix' => 'admin/filemanager',
39+
40+
/*
41+
|--------------------------------------------------------------------------
42+
| Shared folder / Private folder
43+
|--------------------------------------------------------------------------
44+
|
45+
| If both options are set to false, then shared folder will be activated.
46+
|
47+
*/
48+
49+
'allow_private_folder' => true,
50+
51+
// Flexible way to customize client folders accessibility
52+
// If you want to customize client folders, publish tag="lfm_handler"
53+
// Then you can rewrite userField function in App\Handler\ConfigHandler class
54+
// And set 'user_field' to App\Handler\ConfigHandler::class
55+
// Ex: The private folder of user will be named as the user id.
56+
'private_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class,
57+
58+
'allow_shared_folder' => true,
59+
60+
'shared_folder_name' => 'shares',
61+
62+
/*
63+
|--------------------------------------------------------------------------
64+
| Folder Names
65+
|--------------------------------------------------------------------------
66+
*/
67+
68+
'folder_categories' => [
69+
'file' => [
70+
'folder_name' => 'files',
71+
'startup_view' => 'list',
72+
'max_size' => 50000, // size in KB
73+
'thumb' => true,
74+
'thumb_width' => 80,
75+
'thumb_height' => 80,
76+
'valid_mime' => [
77+
'image/jpeg',
78+
'image/pjpeg',
79+
'image/png',
80+
'image/gif',
81+
'application/pdf',
82+
'text/plain',
83+
],
84+
],
85+
'image' => [
86+
'folder_name' => 'photos',
87+
'startup_view' => 'grid',
88+
'max_size' => 50000, // size in KB
89+
'thumb' => true,
90+
'thumb_width' => 80,
91+
'thumb_height' => 80,
92+
'valid_mime' => [
93+
'image/jpeg',
94+
'image/pjpeg',
95+
'image/png',
96+
'image/gif',
97+
],
98+
],
99+
],
100+
101+
/*
102+
|--------------------------------------------------------------------------
103+
| Pagination
104+
|--------------------------------------------------------------------------
105+
*/
106+
107+
'paginator' => [
108+
'perPage' => 30,
109+
],
110+
111+
/*
112+
|--------------------------------------------------------------------------
113+
| Upload / Validation
114+
|--------------------------------------------------------------------------
115+
*/
116+
117+
'disk' => 'public',
118+
119+
'rename_file' => false,
120+
121+
'rename_duplicates' => false,
122+
123+
'alphanumeric_filename' => false,
124+
125+
'alphanumeric_directory' => false,
126+
127+
'should_validate_size' => false,
128+
129+
'should_validate_mime' => true,
130+
131+
// behavior on files with identical name
132+
// setting it to true cause old file replace with new one
133+
// setting it to false show `error-file-exist` error and stop upload
134+
'over_write_on_duplicate' => false,
135+
136+
// mimetypes of executables to prevent from uploading
137+
'disallowed_mimetypes' => ['text/x-php', 'text/html', 'text/plain'],
138+
139+
// extensions of executables to prevent from uploading
140+
'disallowed_extensions' => ['php', 'html'],
141+
142+
// Item Columns
143+
'item_columns' => ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url'],
144+
145+
/*
146+
|--------------------------------------------------------------------------
147+
| Thumbnail
148+
|--------------------------------------------------------------------------
149+
*/
150+
151+
// If true, image thumbnails would be created during upload
152+
'should_create_thumbnails' => true,
153+
154+
'thumb_folder_name' => 'thumbs',
155+
156+
// Create thumbnails automatically only for listed types.
157+
'raster_mimetypes' => [
158+
'image/jpeg',
159+
'image/pjpeg',
160+
'image/png',
161+
],
162+
163+
'thumb_img_width' => 200, // px
164+
165+
'thumb_img_height' => 200, // px
166+
167+
/*
168+
|--------------------------------------------------------------------------
169+
| File Extension Information
170+
|--------------------------------------------------------------------------
171+
*/
172+
173+
'file_type_array' => [
174+
'pdf' => 'Adobe Acrobat',
175+
'doc' => 'Microsoft Word',
176+
'docx' => 'Microsoft Word',
177+
'xls' => 'Microsoft Excel',
178+
'xlsx' => 'Microsoft Excel',
179+
'zip' => 'Archive',
180+
'gif' => 'GIF Image',
181+
'jpg' => 'JPEG Image',
182+
'jpeg' => 'JPEG Image',
183+
'png' => 'PNG Image',
184+
'ppt' => 'Microsoft PowerPoint',
185+
'pptx' => 'Microsoft PowerPoint',
186+
],
187+
188+
/*
189+
|--------------------------------------------------------------------------
190+
| php.ini override
191+
|--------------------------------------------------------------------------
192+
|
193+
| These values override your php.ini settings before uploading files
194+
| Set these to false to ingnore and apply your php.ini settings
195+
|
196+
| Please note that the 'upload_max_filesize' & 'post_max_size'
197+
| directives are not supported.
198+
*/
199+
'php_ini_overrides' => [
200+
'memory_limit' => '256M',
201+
],
202+
];

project/public/assets/admin/js/pages/text-editor.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ $(document).ready(function () {
1414
contents: '<i class="note-icon-picture"></i> ',
1515
tooltip: 'Insert image with filemanager',
1616
click: function () {
17-
18-
lfm({type: 'image', prefix: '/admin/filemanager'}, function (lfmItems, path) {
17+
lfm({type: 'image', prefix: '/admin/laravel-filemanager'}, function (lfmItems, path) {
1918
lfmItems.forEach(function (lfmItem) {
2019
context.invoke('insertImage', lfmItem.url);
2120
});
2221
});
23-
2422
}
2523
});
2624
return button.render();

project/public/vendor/laravel-filemanager/css/cropper.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)