37 lines
775 B
PHP
37 lines
775 B
PHP
|
<?php
|
||
|
|
||
|
namespace Aweos\Resizer\Lib;
|
||
|
|
||
|
use Aweos\Resizer\Compressors\Compressor;
|
||
|
use Aweos\Resizer\Compressors\Factory as CompressorFactory;
|
||
|
use Aweos\Resizer\Models\Setting;
|
||
|
use Illuminate\Support\Collection;
|
||
|
use Illuminate\Support\Facades\Storage;
|
||
|
use MediaLibrary;
|
||
|
|
||
|
class StorageMediaPath extends MediaPath
|
||
|
{
|
||
|
|
||
|
public function __construct(string $path)
|
||
|
{
|
||
|
parent::__construct($path);
|
||
|
$this->path = $path;
|
||
|
}
|
||
|
|
||
|
public function root(): string
|
||
|
{
|
||
|
return Storage::path($this->storagePath());
|
||
|
}
|
||
|
|
||
|
public function publicUrl(): string
|
||
|
{
|
||
|
return MediaLibrary::instance()->findFiles($this->path)[0]->publicUrl;
|
||
|
}
|
||
|
|
||
|
public function get(): string
|
||
|
{
|
||
|
return MediaLibrary::instance()->get($this->path);
|
||
|
}
|
||
|
|
||
|
}
|