Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Application\Admin;
|
||||
|
||||
use App\Domain\Media\Image;
|
||||
@@ -10,30 +12,23 @@ use App\Domain\Media\SaveImageFile;
|
||||
use App\Framework\Attributes\Route;
|
||||
use App\Framework\Auth\Auth;
|
||||
use App\Framework\Core\PathProvider;
|
||||
use App\Framework\Database\Transaction;
|
||||
use App\Framework\DateTime\SystemClock;
|
||||
use App\Framework\Http\Method;
|
||||
use App\Framework\Http\Request;
|
||||
use App\Framework\Http\UploadedFile;
|
||||
use App\Framework\Ulid\StringConverter;
|
||||
use App\Framework\Ulid\Ulid;
|
||||
use Media\Services\ImageService;
|
||||
use function imagecopyresampled;
|
||||
use function imagecreatefromjpeg;
|
||||
use function imagecreatetruecolor;
|
||||
use function imagedestroy;
|
||||
use function imagejpeg;
|
||||
|
||||
class ShowImageUpload
|
||||
{
|
||||
public function __construct(
|
||||
private PathProvider $pathProvider,
|
||||
private StringConverter $stringConverter,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
#[Auth]
|
||||
#[Route('/upload')]
|
||||
public function __invoke()
|
||||
public function __invoke(): void
|
||||
{
|
||||
$html = <<<HTML
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
@@ -47,9 +42,10 @@ class ShowImageUpload
|
||||
echo $html;
|
||||
die();
|
||||
}
|
||||
|
||||
#[Auth]
|
||||
#[Route('/upload', Method::POST)]
|
||||
public function upload(Request $request, Ulid $ulid, ImageRepository $imageRepository, ImageVariantRepository $imageVariantRepository,)
|
||||
public function upload(Request $request, Ulid $ulid, ImageRepository $imageRepository, ImageVariantRepository $imageVariantRepository): void
|
||||
{
|
||||
try {
|
||||
/** @var UploadedFile $file */
|
||||
@@ -76,11 +72,13 @@ class ShowImageUpload
|
||||
echo "<h2>Bild bereits vorhanden</h2>";
|
||||
echo "<p>Dieses Bild wurde bereits hochgeladen.</p>";
|
||||
echo "<p>Bild-ID: " . htmlspecialchars($existingImage->ulid) . "</p>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$idStr = str_pad((string)$id, 9, '0', STR_PAD_LEFT);
|
||||
$filePathPattern = sprintf('%s/%s/%s',
|
||||
$filePathPattern = sprintf(
|
||||
'%s/%s/%s',
|
||||
substr($idStr, 0, 3),
|
||||
substr($idStr, 3, 3),
|
||||
substr($idStr, 6, 3),
|
||||
@@ -125,7 +123,8 @@ class ShowImageUpload
|
||||
#mkdir($path, 0755, true);
|
||||
$variant = new ImageResizer()($image, 50, 50);
|
||||
|
||||
$imageVariantRepository->save($variant);;
|
||||
$imageVariantRepository->save($variant);
|
||||
;
|
||||
|
||||
$href = "/images/".$variant->filename;
|
||||
echo "<a href='$href'>$href</a>";
|
||||
|
||||
Reference in New Issue
Block a user