oc-resizer-plugin/lib/StorageMediaPath.php

37 lines
775 B
PHP
Raw Normal View History

2022-02-16 02:49:19 +01:00
<?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);
}
}