Skip to content

Commit

Permalink
fix: replace directory separator with forward slash
Browse files Browse the repository at this point in the history
  • Loading branch information
JaZo committed Nov 26, 2023
1 parent 56f6a6d commit 380e296
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ImageProviders/MyImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public function getImage(): Image
}

$images = app(Filesystem::class)->files(public_path($this->directory));
$image = Str::replaceStart(public_path(), '', $images[array_rand($images)]->getPathname());
$image = Str::of($images[array_rand($images)]->getPathname())
->replaceStart(public_path(), '')
->replace(DIRECTORY_SEPARATOR, '/')
->toString();

return new Image(
'url("' . asset($image) . '")'
Expand Down

0 comments on commit 380e296

Please sign in to comment.