Skip to content

Commit

Permalink
added svg support to image seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
A1Gard committed Nov 19, 2024
1 parent fbd2c43 commit e34ca79
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Console/Commands/SeedingImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public function handle()
}
break;
case 'Category':
$svgs = \File::files(__DIR__ . '/../../../database/seeders/images/svg');

foreach (Category::all() as $item) {
$this->info('Category: ' . $item->name . ' adding image...');
shuffle($images);
Expand All @@ -75,6 +77,9 @@ public function handle()
->optimize()
->format('webp');
$i->save(storage_path() . '/app/public/categories/optimized-'. $item->bg);
shuffle($svgs);
\File::copy($svgs[0]->getRealPath(),storage_path().'/app/public/categories/' . $svgs[0]->getFilename());
$item->svg = $svgs[0]->getFilename();
$item->save();
}
break;
Expand Down

0 comments on commit e34ca79

Please sign in to comment.