diff --git a/src/Infrastructure/Http/Controller/Admin/PhotoManagementController.php b/src/Infrastructure/Http/Controller/Admin/PhotoManagementController.php index 4a9ec1e..cbc4874 100644 --- a/src/Infrastructure/Http/Controller/Admin/PhotoManagementController.php +++ b/src/Infrastructure/Http/Controller/Admin/PhotoManagementController.php @@ -7,6 +7,7 @@ namespace App\Infrastructure\Http\Controller\Admin; use App\Application\Article\PhotoService; use App\Domain\Article\Repository\ArticlePhotoRepositoryInterface; use App\Domain\Article\Repository\ArticleRepositoryInterface; +use App\Domain\Pipeline\Repository\AIPipelineJobRepositoryInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -23,6 +24,7 @@ final class PhotoManagementController extends AbstractController private readonly ArticleRepositoryInterface $articleRepository, private readonly ArticlePhotoRepositoryInterface $photoRepository, private readonly PhotoService $photoService, + private readonly AIPipelineJobRepositoryInterface $jobRepository, ) { } @@ -36,9 +38,21 @@ final class PhotoManagementController extends AbstractController $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', [ 'article' => $article, 'photos' => $photos, + 'searchPhotoFilename' => $searchPhotoFilename, ]); } diff --git a/templates/admin/photo_management.html.twig b/templates/admin/photo_management.html.twig index 604e756..5f5308a 100644 --- a/templates/admin/photo_management.html.twig +++ b/templates/admin/photo_management.html.twig @@ -27,6 +27,30 @@