images: nur freigegebene Bilder in Feed und PDF, versionierte Veröffentlichungssnapshots, Bestätigung an das gezeigte Bild gebunden, getrennte Rückhaltegründe (Umsetzungsaudit 29.09.: B-01 bis B-14, N09, OPT-3 bis OPT-5; 02.10.: O03)
- B-01/B-02: Startseiten-Feed, Card-Helfer und Nachweis-PDF nur mit isPubliclyDeliverable() - B-03: Livewire-Temp-Upload 16 MiB - N09: Snapshot je Bytes- und Metadaten-Hash inkl. OG-Variante, put() geprüft, alle Fassungen ins Archiv - O03: published_ever_at in der Freigabetransaktion (markPublishedIfNowPublic) — Kundenbestätigung, Vorab-Sichtung, Korrektur - B-04/B-14: Bestätigung an Bild-ID und SHA gebunden, unter Sperre - B-05/B-06: Entfernen unter Sperre mit frischem Stand und Archivauftrag; Korrektur archiviert über den Auftrag, Nacharbeiten abgesichert - B-07: precheck_withheld_at getrennt von withheld_at (Migration + Übernahme) - B-08, B-09, B-11, B-12: published_ever_at nur bei Status published, Admin-Eigentümer mit Kundenregel, Sweep verwaister Originale, Verarbeitungsfehler als Formularmeldung - K-02-Teil: nach Kundenbestätigung erneut routen - OPT-3 bis OPT-5: pingImage für JPEG, Hash durchgereicht, erstes Frame Admin-PM-Detailseite enthält zusätzlich K-06 (Autorisierung) und A-08 (Nachweis per POST), weil die Datei ungeteilt committet ist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
60650baeb8
commit
f1c0e2766b
23 changed files with 1675 additions and 149 deletions
|
|
@ -139,8 +139,12 @@ class ImageProvenanceInspector
|
|||
}
|
||||
|
||||
/**
|
||||
* Öffnet die Datei einmal mit Imagick und liest die eingebetteten
|
||||
* IPTC- und XMP-Profile. Wirft, wenn die Datei kein lesbares Bild ist.
|
||||
* Öffnet die Datei mit Imagick und liest die eingebetteten IPTC- und
|
||||
* XMP-Profile. Wirft, wenn die Datei kein lesbares Bild ist.
|
||||
*
|
||||
* OPT-3 (Umsetzungsaudit 29.09.): JPEG nur „anpingen" (Kopf und
|
||||
* Profile ohne Pixeldekodierung). Die PNG- und WebP-Coder liefern beim
|
||||
* Ping kein XMP (mit Fixtures geprüft) — dort weiter voll lesen.
|
||||
*
|
||||
* @return array{iptc: string|null, xmp: string|null}
|
||||
*/
|
||||
|
|
@ -153,7 +157,13 @@ class ImageProvenanceInspector
|
|||
$imagick = new Imagick;
|
||||
|
||||
try {
|
||||
$imagick->readImage($absolutePath);
|
||||
$imagick->pingImage($absolutePath);
|
||||
|
||||
if (strtoupper($imagick->getImageFormat()) !== 'JPEG') {
|
||||
$imagick->clear();
|
||||
$imagick->readImage($absolutePath);
|
||||
}
|
||||
|
||||
$profiles = $imagick->getImageProfiles('*', true);
|
||||
} finally {
|
||||
$imagick->clear();
|
||||
|
|
|
|||
|
|
@ -4,12 +4,15 @@ namespace App\Services\Image\Precheck;
|
|||
|
||||
use App\Enums\ArchiveEvent;
|
||||
use App\Enums\ArchiveReasonCategory;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\KiAudit;
|
||||
use App\Models\PressReleaseImage;
|
||||
use App\Models\User;
|
||||
use App\Services\PressRelease\Images\PressReleaseImageRemover;
|
||||
use App\Services\PressRelease\Images\PublishedImageSnapshot;
|
||||
use App\Support\WebCaches;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Admin-Queue des Vorab-Checks (DU 12.3, 12.5): Ein Bild mit Ausgang
|
||||
|
|
@ -19,7 +22,10 @@ use Illuminate\Support\Facades\DB;
|
|||
*/
|
||||
class ImagePrecheckReviewService
|
||||
{
|
||||
public function __construct(private readonly PressReleaseImageRemover $remover) {}
|
||||
public function __construct(
|
||||
private readonly PressReleaseImageRemover $remover,
|
||||
private readonly PublishedImageSnapshot $snapshots,
|
||||
) {}
|
||||
|
||||
public function approve(PressReleaseImage $image, User $admin, string $note): void
|
||||
{
|
||||
|
|
@ -28,14 +34,33 @@ class ImagePrecheckReviewService
|
|||
'precheck_reviewed_at' => now(),
|
||||
'precheck_reviewed_by' => $admin->getKey(),
|
||||
'precheck_review_note' => $note,
|
||||
'withheld_at' => null,
|
||||
// Nur der eigene Grund fällt (Umsetzungsaudit 29.09., B-07):
|
||||
// ein Rückhalt aus dem Korrekturweg bleibt bestehen.
|
||||
'precheck_withheld_at' => null,
|
||||
])->save();
|
||||
$image->markPublishedIfNowPublic();
|
||||
|
||||
$this->audit($image, 'approved', $note);
|
||||
});
|
||||
|
||||
if ($image->pressRelease?->published_at !== null) {
|
||||
WebCaches::forgetPublicPages();
|
||||
$pressRelease = $image->pressRelease;
|
||||
|
||||
if ($pressRelease?->status === PressReleaseStatus::Published && $image->isPubliclyDeliverable()) {
|
||||
// Jetzt erst öffentlich: Veröffentlichungssnapshot (N09) nach
|
||||
// dem N08-Muster — Fehler werden gemeldet, nicht geworfen.
|
||||
try {
|
||||
$this->snapshots->capture($image, $pressRelease);
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
}
|
||||
}
|
||||
|
||||
if ($pressRelease?->published_at !== null) {
|
||||
try {
|
||||
WebCaches::forgetPublicPages();
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,17 +24,21 @@ class PrecheckImagePreparer
|
|||
$maxEdge = max(256, (int) config('images.precheck.max_edge', 1024));
|
||||
$quality = (int) config('images.precheck.jpeg_quality', 82);
|
||||
|
||||
$imagick = new Imagick;
|
||||
$source = new Imagick;
|
||||
$imagick = $source;
|
||||
|
||||
try {
|
||||
$imagick->readImage($absolutePath);
|
||||
$imagick->setIteratorIndex(0);
|
||||
// Nur das erste Bild lesen (OPT-5): Animationen und Mehrseiter
|
||||
// werden nicht vollständig dekodiert.
|
||||
$source->readImage($absolutePath.'[0]');
|
||||
$source->setIteratorIndex(0);
|
||||
|
||||
$imagick->autoOrient();
|
||||
$source->autoOrient();
|
||||
|
||||
$imagick->setImageBackgroundColor('white');
|
||||
$imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE);
|
||||
$imagick = $imagick->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
|
||||
$source->setImageBackgroundColor('white');
|
||||
$source->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE);
|
||||
$imagick = $source->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
|
||||
$source->clear();
|
||||
$imagick->stripImage();
|
||||
|
||||
$width = $imagick->getImageWidth();
|
||||
|
|
@ -51,6 +55,7 @@ class PrecheckImagePreparer
|
|||
$bytes = $imagick->getImageBlob();
|
||||
} finally {
|
||||
$imagick->clear();
|
||||
$source->clear();
|
||||
}
|
||||
|
||||
if ($bytes === '') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue