WIP
This commit is contained in:
30
app/Support/ShortFileNamer.php
Normal file
30
app/Support/ShortFileNamer.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace App\Support;
|
||||
|
||||
use Spatie\MediaLibrary\Support\FileNamer\FileNamer;
|
||||
use Spatie\MediaLibrary\Conversions\Conversion;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ShortFileNamer extends FileNamer
|
||||
{
|
||||
/**
|
||||
* Keep the original file name exactly as it was uploaded.
|
||||
*/
|
||||
public function originalFileName(string $fileName): string
|
||||
{
|
||||
return pathinfo($fileName, PATHINFO_FILENAME);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function conversionFileName(string $fileName, Conversion $conversion): string
|
||||
{
|
||||
return Str::random(12);
|
||||
}
|
||||
|
||||
public function responsiveFileName(string $fileName): string
|
||||
{
|
||||
return 'res';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user