Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from KonektOU/master
Browse files Browse the repository at this point in the history
Fix image path in regenerate-thumbnails command
  • Loading branch information
Tarpsvo authored Jan 31, 2022
2 parents ddb9a6d + 2b81a89 commit a8ec438
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Commands/RegenerateThumbnails.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ public function handle()

$updateCount = 0;
$totalCount = $medias->count();
$rootPath = storage_path('app/');
$this->output->write("\n");

foreach ($medias as $media) {
if ($handler->isReadableImage($rootPath . $media->path . $media->file_name)) {
$mediaPath = $media->getDisk()->path($media->file_path);

if ($handler->isReadableImage($mediaPath)) {
try {
$generatedImages = $handler->generateImageSizes(file_get_contents($rootPath . $media->path . $media->file_name), $media->path . $media->file_name, Storage::disk('local'));
$generatedImages = $handler->generateImageSizes(file_get_contents($mediaPath), $media->file_path, $media->mime_type, $media->getDisk());
$media->image_sizes = json_encode($generatedImages);
$media->save();
} catch (\Exception $e) {
Expand Down

0 comments on commit a8ec438

Please sign in to comment.