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 07aae59 commit 09db21f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 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-data": "^3.2",
"spatie/laravel-json-api-paginate": "^1.13",
"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
10 changes: 8 additions & 2 deletions src/UI/Filament/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ public static function form(Forms\Form $form): Forms\Form
Forms\Components\SpatieMediaLibraryFileUpload::make('photo')
->label(__('admin-kit-products::products.resource.photo'))
->collection('photo')
->required(),
->image()
->required()
->optimize('webp')
->resize(30),
TranslatableTabs::make(fn ($locale) => Tab::make($locale)->schema([
Forms\Components\TextInput::make('title.'.$locale)
->label(__('admin-kit-products::products.resource.name'))
Expand All @@ -34,7 +37,10 @@ public static function form(Forms\Form $form): Forms\Form
Forms\Components\SpatieMediaLibraryFileUpload::make('attachments.'.$locale)
->label(__('admin-kit-products::products.resource.attachments'))
->collection('attachments.'.$locale)
->multiple(),
->multiple()
->image()
->optimize('webp')
->resize(30),
])),
])
->columns(1);
Expand Down

0 comments on commit 09db21f

Please sign in to comment.