You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
642 B
22 lines
642 B
<?php
|
|
|
|
namespace Tests\Feature\Traits;
|
|
|
|
use App\Image\ImageProcessor;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
trait FileImageTrait
|
|
{
|
|
|
|
public function createImageForModel(\App\Models\Collection $collection, \App\Models\File $file): void
|
|
{
|
|
$imageProcessor = new ImageProcessor;
|
|
$imageProcessor->createFakeImage(storage_path('stub') . '/image.png', Storage::disk($collection->disk)->path($file->server_path . $file->uuid . '.' . $collection->ext));
|
|
}
|
|
|
|
public function deleteFakeImageForModel(\App\Models\File $file): void
|
|
{
|
|
unlink($file->getPath());
|
|
unlink($file->getModifiedPath());
|
|
}
|
|
}
|