- press_release_images: Kundenangabe/Portalkennzeichnung getrennt, Herkunftsbefund, Beweisoriginal, Snapshot-Pfade, published_ever_at, rules_version, Fokus/Letterbox; Bestand unangetastet - legal_texts (insert-only) mit img-confirm-v1 (alter Wortlaut), v2 (AGB 0.6), v3 (AGB 0.7, noch ohne Datum); image-rights:backfill-confirmations - image_rights_confirmations polymorph, insert-only, IP als versionierter HMAC; Löschung nur für nie veröffentlichte Uploads - ImageProvenanceInspector (Imagick/exif): IPTC, XMP, EXIF; algorithmicallyEnhanced nur Vermerk; unlesbare Datei = error - PressReleaseImageUploader: Original vor Derivaten, Hash-Bindung, Titelbild-Regel unter Sperre, Dateien bei Fehlern zurückgerollt; Admin-Upload ohne Bestätigung - ImageService: kein Rückfall auf die Quelldatei, og-Variante, Fokuspunkt und no_crop Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
86 lines
2.8 KiB
PHP
86 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\AiDeclarationSource;
|
|
use App\Enums\AiImageDeclaration;
|
|
use App\Enums\CreditSource;
|
|
use App\Enums\ImageProvenanceStatus;
|
|
use App\Models\PressRelease;
|
|
use App\Models\PressReleaseImage;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<PressReleaseImage>
|
|
*/
|
|
class PressReleaseImageFactory extends Factory
|
|
{
|
|
protected $model = PressReleaseImage::class;
|
|
|
|
/**
|
|
* Standard: Bild aus dem heutigen (alten) Formular — Bestand ohne
|
|
* `rules_version`, aber mit Kennzeichnung und Nachweis.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$name = Str::uuid()->toString();
|
|
|
|
return [
|
|
'press_release_id' => PressRelease::factory(),
|
|
'disk' => 'local',
|
|
'path' => "press-releases/1/images/variants/{$name}-cover.jpg",
|
|
'variants' => [
|
|
'thumb' => "press-releases/1/images/variants/{$name}-thumb.jpg",
|
|
'cover' => "press-releases/1/images/variants/{$name}-cover.jpg",
|
|
],
|
|
'copyright' => fake()->company(),
|
|
'author' => fake()->name(),
|
|
'ai_declaration' => AiImageDeclaration::Original->value,
|
|
'is_preview' => true,
|
|
'sort_order' => 1,
|
|
'width' => 1280,
|
|
'height' => 580,
|
|
'mime' => 'image/jpeg',
|
|
'rights_confirmed_at' => now(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Legacy-Import: kein Nachweis, keine Kennzeichnung, kein Protokoll.
|
|
*/
|
|
public function legacy(): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'copyright' => null,
|
|
'author' => null,
|
|
'ai_declaration' => null,
|
|
'rights_confirmed_at' => null,
|
|
'legacy_portal' => 'presseecho',
|
|
'legacy_id' => fake()->unique()->numberBetween(1, 900_000),
|
|
'path' => 'presseecho/press/'.fake()->slug(3).'.jpg',
|
|
'variants' => null,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Bild aus Formular v2: Beweisoriginal, Prüfergebnis, Regelversion.
|
|
*/
|
|
public function rulesV2(): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'rules_version' => config('images.rules_version'),
|
|
'ai_declaration_user' => AiImageDeclaration::Original->value,
|
|
'ai_declaration_source' => AiDeclarationSource::Customer->value,
|
|
'credit_source' => CreditSource::Customer->value,
|
|
'provenance_status' => ImageProvenanceStatus::Absent->value,
|
|
'provenance' => ['status' => 'absent'],
|
|
'provenance_checked_at' => now(),
|
|
'original_disk' => 'local',
|
|
'original_path' => 'press-release-originals/1/'.Str::uuid()->toString().'.jpg',
|
|
'original_sha256' => hash('sha256', Str::random(40)),
|
|
]);
|
|
}
|
|
}
|