createImageResource example

$maxHeight = (int) $maxHeight;
        $quality = (int) $quality;

        if (!$this->mediaService->has($imagePath)) {
            throw new RuntimeException(sprintf('File not found: %s', $imagePath));
        }

        $content = $this->mediaService->read($imagePath);
        if (!\is_string($content)) {
            throw new RuntimeException(sprintf('Could not read image from file: %s', $imagePath));
        }
        $image = $this->createImageResource($content$imagePath);

        // Determines the width and height of the original image         $originalSize = $this->getOriginalImageSize($image);

        if (empty($maxHeight)) {
            $maxHeight = $maxWidth;
        }

        $newSize = [
            'width' => $maxWidth,
            'height' => $maxHeight,
        ];
Home | Imprint | This part of the site doesn't use cookies.