Skip to content

Commit

Permalink
feat: add image optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
daurensky committed Mar 19, 2024
1 parent 1c27460 commit 69693aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"spatie/laravel-json-api-paginate": "^1.13",
"spatie/laravel-package-tools": "^1.14.0",
"spatie/laravel-query-builder": "^5.7",
"spatie/laravel-translatable": "^6.5"
"spatie/laravel-translatable": "^6.5",
"joshembling/image-optimizer": "^1.4"
},
"require-dev": {
"laravel/pint": "^1.0",
Expand Down
12 changes: 9 additions & 3 deletions src/UI/Filament/Resources/CompanyResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public static function form(Forms\Form $form): Forms\Form
->label(__('admin-kit-companies::companies.resource.background'))
->collection('background')
->image()
->columnSpan(2),
->columnSpan(2)
->optimize('webp')
->resize(30),

TranslatableTabs::make(fn ($locale) => Tab::make($locale)->schema([
Forms\Components\Section::make(__('admin-kit-companies::companies.resource.general'))->schema([
Expand Down Expand Up @@ -54,11 +56,15 @@ public static function form(Forms\Form $form): Forms\Form
->label(__('admin-kit-companies::companies.resource.attachments'))
->collection('mission_attachments.'.$locale)
->multiple()
->image(),
->image()
->optimize('webp')
->resize(30),
SpatieMediaLibraryFileUpload::make('mission_background.'.$locale)
->label(__('admin-kit-companies::companies.resource.background'))
->collection('mission_background.'.$locale)
->image(),
->image()
->optimize('webp')
->resize(30),
]),
]))->columnSpan(2),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public function form(Forms\Form $form): Forms\Form
Forms\Components\SpatieMediaLibraryFileUpload::make('image')
->label(__('admin-kit-companies::companies.relations.managers.photo'))
->required()
->columnSpan(2),
->columnSpan(2)
->image()
->optimize('webp')
->resize(30),
TranslatableTabs::make(fn ($locale) => Tab::make($locale)->schema([
Forms\Components\TextInput::make('name.'.$locale)
->label(__('admin-kit-companies::companies.relations.managers.name'))
Expand Down

0 comments on commit 69693aa

Please sign in to comment.