Skip to content

Commit

Permalink
feat: add processImage function to jsonService
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdmlln committed Feb 14, 2024
1 parent cddd7c2 commit 0780e25
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Classes/Service/JsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

namespace Remind\Headless\Service;

use FriendsOfTYPO3\Headless\Utility\FileUtility;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;
use TYPO3\CMS\Core\Pagination\PaginationInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Extbase\Service\ImageService;

class JsonService
{
Expand All @@ -18,6 +20,8 @@ class JsonService
public function __construct(
private readonly UriBuilder $uriBuilder,
private readonly LoggerInterface $logger,
private readonly ImageService $imageService,
private readonly FileUtility $fileUtility,
RequestBuilder $requestBuilder,
ConfigurationManagerInterface $configurationManager
) {
Expand Down Expand Up @@ -87,6 +91,12 @@ public function serializePagination(PaginationInterface $pagination, string $que
return $result;
}

public function processImage(int $uid): ?array
{
$imageObj = $this->imageService->getImage(strval($uid), null, true);
return $this->fileUtility->processFile($imageObj);
}

private function getRequest(): ServerRequestInterface
{
return $GLOBALS['TYPO3_REQUEST'];
Expand Down

0 comments on commit 0780e25

Please sign in to comment.