30 lines
669 B
PHP
30 lines
669 B
PHP
<?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';
|
|
}
|
|
} |