Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Dec 17, 2024
1 parent 0d23dbb commit 6964d02
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Helpers/FileOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ public function __construct()
*/
public function write(CacheEntry $asset): void
{
$dev = config('backpack.basset.dev_mode', false);
$filePath = $dev ? $asset->getAssetPath() : $asset->getAssetDiskPath();
$filePath = $asset->getAssetDiskPath();
$extension = (string) Str::of($filePath)->afterLast('.');

// map extensions
$file = match ($extension) {
'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg' => 'img',
'mp3', 'ogg', 'wav', 'mp4', 'webm', 'avi' => 'source',
'pdf' => 'object',
'vtt' => 'track',
'pdf' => 'object',
'vtt' => 'track',
default => $extension
};

Expand All @@ -57,7 +56,7 @@ public function write(CacheEntry $asset): void
}

echo Blade::render($template, [
'src' => $this->assetPath($filePath),
'src' => $this->assetPath($filePath),
'args' => $this->prepareAttributes($asset->getAttributes()),
]);
}
Expand Down

0 comments on commit 6964d02

Please sign in to comment.