feat: show recognition photo on photo management page
Some checks are pending
CI / test (push) Waiting to run

Displays the original pipeline search photo (storedPhotoPath from
AIPipelineJob input_data) as a read-only card above the editable photos.
The photo is fetched only if the file still exists on disk.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Simon Kuehn 2026-05-19 16:00:53 +00:00
parent f1d3ee6b1e
commit 59b34a780e
2 changed files with 38 additions and 0 deletions

View file

@ -7,6 +7,7 @@ namespace App\Infrastructure\Http\Controller\Admin;
use App\Application\Article\PhotoService; use App\Application\Article\PhotoService;
use App\Domain\Article\Repository\ArticlePhotoRepositoryInterface; use App\Domain\Article\Repository\ArticlePhotoRepositoryInterface;
use App\Domain\Article\Repository\ArticleRepositoryInterface; use App\Domain\Article\Repository\ArticleRepositoryInterface;
use App\Domain\Pipeline\Repository\AIPipelineJobRepositoryInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
@ -23,6 +24,7 @@ final class PhotoManagementController extends AbstractController
private readonly ArticleRepositoryInterface $articleRepository, private readonly ArticleRepositoryInterface $articleRepository,
private readonly ArticlePhotoRepositoryInterface $photoRepository, private readonly ArticlePhotoRepositoryInterface $photoRepository,
private readonly PhotoService $photoService, private readonly PhotoService $photoService,
private readonly AIPipelineJobRepositoryInterface $jobRepository,
) { ) {
} }
@ -36,9 +38,21 @@ final class PhotoManagementController extends AbstractController
$photos = $this->photoRepository->findByArticle(Uuid::fromString($id)); $photos = $this->photoRepository->findByArticle(Uuid::fromString($id));
$searchPhotoFilename = null;
$job = $this->jobRepository->findByArticleId(Uuid::fromString($id));
if (null !== $job) {
$storedPath = \is_string($job->getInputData()['storedPhotoPath'] ?? null)
? $job->getInputData()['storedPhotoPath']
: '';
if ('' !== $storedPath && file_exists($storedPath)) {
$searchPhotoFilename = basename($storedPath);
}
}
return $this->render('admin/photo_management.html.twig', [ return $this->render('admin/photo_management.html.twig', [
'article' => $article, 'article' => $article,
'photos' => $photos, 'photos' => $photos,
'searchPhotoFilename' => $searchPhotoFilename,
]); ]);
} }

View file

@ -27,6 +27,30 @@
<div class="row g-4"> <div class="row g-4">
{# ── Search / recognition photo (read-only) ────────────────────────── #}
{% if searchPhotoFilename %}
<div class="col-12">
<div class="card border-secondary">
<div class="card-header bg-secondary bg-opacity-10 d-flex align-items-center gap-2">
<i class="fa fa-search text-secondary"></i>
<span class="fw-semibold">Erkennungs-Foto</span>
<span class="text-muted small">(vom KI-Pipeline-Einlesen — unveränderlich)</span>
</div>
<div class="card-body d-flex align-items-center gap-4">
<img src="{{ path('admin_photo_serve', {filename: searchPhotoFilename}) }}"
alt="Erkennungs-Foto"
class="rounded border"
style="max-height:160px;max-width:200px;object-fit:contain;">
<div class="text-muted small">
<i class="fa fa-info-circle me-1"></i>
Dieses Foto wurde beim Einlesen für die KI-Erkennung (Typenschild) verwendet.
Es kann hier nicht geändert werden.
</div>
</div>
</div>
</div>
{% endif %}
{# ── Current photos ────────────────────────────────────────────────── #} {# ── Current photos ────────────────────────────────────────────────── #}
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">