Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
use App\Services\Upload\PreviewService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
it('generates a smart square thumb during preview creation', function () {
Storage::fake('local');
$uploadId = (string) Str::uuid();
$file = UploadedFile::fake()->image('preview-source.jpg', 1200, 800);
$path = $file->storeAs("tmp/drafts/{$uploadId}/main", 'preview-source.jpg', 'local');
$result = app(PreviewService::class)->generateFromImage($uploadId, $path);
expect(Storage::disk('local')->exists($result['preview_path']))->toBeTrue()
->and(Storage::disk('local')->exists($result['thumb_path']))->toBeTrue();
$thumbSize = getimagesizefromstring(Storage::disk('local')->get($result['thumb_path']));
expect($thumbSize[0] ?? null)->toBe(320)
->and($thumbSize[1] ?? null)->toBe(320);
});