Skip to content

Commit

Permalink
feat: allow localUid in asset middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdmlln committed Aug 28, 2024
1 parent edca853 commit d5db97a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Classes/Middleware/AssetMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
$path = $routing->getUri()->getPath();
$queryParams = $request->getQueryParams();
$uid = $queryParams['uid'] ?? null;
$uidLocal = $queryParams['uidLocal'] ?? null;
if (
$path === '/asset' &&
$uid
(
$uid ||
$uidLocal
)
) {
$resource = $this->resourceFactory->getFileReferenceObject($uid);
$resource = $uid
? $this->resourceFactory->getFileReferenceObject($uid)
: $this->resourceFactory->getFileObject($uidLocal);

$tstamp = intval($resource->getProperty('tstamp'));
$lastModified = gmdate('D, d M Y H:i:s', $tstamp) . ' GMT';
Expand All @@ -75,7 +81,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
) {
$cropVariant = $queryParams['breakpoint'] ?? 'default';

$crop = $resource->getProperty('crop');
$crop = $resource->getProperty('crop') ?? '';
$cropVariantCollection = CropVariantCollection::create($crop);
$cropArea = $cropVariantCollection->getCropArea($cropVariant);

Expand All @@ -93,7 +99,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
'width' => $queryParams['width'] ?? null,
];

$processedResource = $this->imageService->applyProcessingInstructions($resource, $processingInstructions);
$processedResource = $this->imageService->applyProcessingInstructions(
$resource,
$processingInstructions
);
}
}

Expand Down

0 comments on commit d5db97a

Please sign in to comment.