protected function executeResize(ImageInterface $image, ResizeCoordinatesInterface $coordinates, $path, ResizeOptionsInterface $options): ImageInterface
    {
        if ($this->legacyImage && $this->hasGetImageHook()) {
            $rootDir = System::getContainer()->getParameter('kernel.project_dir');

            foreach ($GLOBALS['TL_HOOKS']['getImage'] as $callback) {
                $return = System::importStatic($callback[0])->{$callback[1]}(
                    $this->legacyImage->getOriginalPath(),
                    $this->legacyImage->getTargetWidth(),
                    $this->legacyImage->getTargetHeight(),
                    $this->legacyImage->getResizeMode(),
                    $this->legacyImage->getCacheName(),
                    new File($this->legacyImage->getOriginalPath()),
                    $this->legacyImage->getTargetPath(),
                    $this->legacyImage
                );

                if (\is_string($return)) {
                    return $this->createImage($image, $rootDir.'/'.$return);
                }
            }
        }

        if ($image->getImagine() instanceof GdImagine) {
            $dimensions = $image->getDimensions();

            /** @var Config $config */
            $config = $this->framework->getAdapter(Config::class);
            $gdMaxImgWidth = $config->get('gdMaxImgWidth');
            $gdMaxImgHeight = $config->get('gdMaxImgHeight');

            // Return the path to the original image if it cannot be handled
            if (
                $dimensions->getSize()->getWidth() > $gdMaxImgWidth
                || $dimensions->getSize()->getHeight() > $gdMaxImgHeight
                || $coordinates->getSize()->getWidth() > $gdMaxImgWidth
                || $coordinates->getSize()->getHeight() > $gdMaxImgHeight
            ) {
                return $this->createImage($image, $image->getPath());
            }
        }

        return parent::executeResize($image, $coordinates, $path, $options);
    }
protected function executeResize(ImageInterface $image, ResizeCoordinatesInterface $coordinates, $path, ResizeOptionsInterface $options): ImageInterface
    {
        if ($this->legacyImage && $this->hasGetImageHook()) {
            $rootDir = System::getContainer()->getParameter('kernel.project_dir');

            foreach ($GLOBALS['TL_HOOKS']['getImage'] as $callback) {
                $return = System::importStatic($callback[0])->{$callback[1]}(
                    $this->legacyImage->getOriginalPath(),
                    $this->legacyImage->getTargetWidth(),
                    $this->legacyImage->getTargetHeight(),
                    $this->legacyImage->getResizeMode(),
                    $this->legacyImage->getCacheName(),
                    new File($this->legacyImage->getOriginalPath()),
                    $this->legacyImage->getTargetPath(),
                    $this->legacyImage
                );

                if (\is_string($return)) {
                    return $this->createImage($image, $rootDir.'/'.$return);
                }
            }
        }

        if ($image->getImagine() instanceof GdImagine) {
            $dimensions = $image->getDimensions();

            
            $config = $this->framework->getAdapter(Config::class);
            $gdMaxImgWidth = $config->get('gdMaxImgWidth');
            $gdMaxImgHeight = $config->get('gdMaxImgHeight');

            
            if (
                $dimensions->getSize()->getWidth() > $gdMaxImgWidth
                || $dimensions->getSize()->getHeight() > $gdMaxImgHeight
                || $coordinates->getSize()->getWidth() > $gdMaxImgWidth
                || $coordinates->getSize()->getHeight() > $gdMaxImgHeight
            ) {
                return $this->createImage($image, $image->getPath());
            }
        }

        return parent::executeResize($image, $coordinates, $path, $options);
    }
protected function executeResize ( ImageInterface $ image , ResizeCoordinatesInterface $ coordinates , $ path , ResizeOptionsInterface $ options ) : ImageInterface { if ( $ this -> legacyImage && $ this -> hasGetImageHook ( ) ) { $ rootDir = System :: getContainer ( ) -> getParameter ( 'kernel.project_dir' ) ; foreach ( $ GLOBALS [ 'TL_HOOKS' ] [ 'getImage' ] as $ callback ) { $ return = System :: importStatic ( $ callback [ 0 ] ) -> { $ callback [ 1 ] } ( $ this -> legacyImage -> getOriginalPath ( ) , $ this -> legacyImage -> getTargetWidth ( ) , $ this -> legacyImage -> getTargetHeight ( ) , $ this -> legacyImage -> getResizeMode ( ) , $ this -> legacyImage -> getCacheName ( ) , new File ( $ this -> legacyImage -> getOriginalPath ( ) ) , $ this -> legacyImage -> getTargetPath ( ) , $ this -> legacyImage ) ; if ( \ is_string ( $ return ) ) { return $ this -> createImage ( $ image , $ rootDir . '/' . $ return ) ; } } } if ( $ image -> getImagine ( ) instanceof GdImagine ) { $ dimensions = $ image -> getDimensions ( ) ; /** @var Config $config */ $ config = $ this -> framework -> getAdapter ( Config :: class ) ; $ gdMaxImgWidth = $ config -> get ( 'gdMaxImgWidth' ) ; $ gdMaxImgHeight = $ config -> get ( 'gdMaxImgHeight' ) ; // Return the path to the original image if it cannot be handled if ( $ dimensions -> getSize ( ) -> getWidth ( ) > $ gdMaxImgWidth || $ dimensions -> getSize ( ) -> getHeight ( ) > $ gdMaxImgHeight || $ coordinates -> getSize ( ) -> getWidth ( ) > $ gdMaxImgWidth || $ coordinates -> getSize ( ) -> getHeight ( ) > $ gdMaxImgHeight ) { return $ this -> createImage ( $ image , $ image -> getPath ( ) ) ; } } return parent :: executeResize ( $ image , $ coordinates , $ path , $ options ) ; }
{@inheritdoc}
{