core-bundle/src/Resources/contao/library/Contao/Image.php
public function executeResize()
	{
		$image = $this->prepareImage();
		$resizeConfig = $this->prepareResizeConfig();

		if (!System::getContainer()->getParameter('contao.image.bypass_cache')
			&& $this->getTargetPath()
			&& !$this->getForceOverride()
			&& file_exists($this->strRootDir . '/' . $this->getTargetPath())
			&& $this->fileObj->mtime <= filemtime($this->strRootDir . '/' . $this->getTargetPath())
		) {
			// HOOK: add custom logic
			if (isset($GLOBALS['TL_HOOKS']['executeResize']) && \is_array($GLOBALS['TL_HOOKS']['executeResize']))
			{
				foreach ($GLOBALS['TL_HOOKS']['executeResize'] as $callback)
				{
					$return = System::importStatic($callback[0])->{$callback[1]}($this);

					if (\is_string($return))
					{
						$this->resizedPath = System::urlEncode($return);

						return $this;
					}
				}
			}

			$this->resizedPath = System::urlEncode($this->getTargetPath());

			return $this;
		}

		$image = System::getContainer()
			->get('contao.image.resizer')
			->resize(
				$image,
				$resizeConfig,
				(new ResizeOptions())
					->setImagineOptions(System::getContainer()->getParameter('contao.image.imagine_options'))
					->setTargetPath($this->targetPath ? $this->strRootDir . '/' . $this->targetPath : null)
					->setBypassCache(System::getContainer()->getParameter('contao.image.bypass_cache'))
			)
		;

		$this->resizedPath = $image->getUrl($this->strRootDir);

		return $this;
	}
public function executeResize()
	{
		$image = $this->prepareImage();
		$resizeConfig = $this->prepareResizeConfig();

		if (!System::getContainer()->getParameter('contao.image.bypass_cache')
			&& $this->getTargetPath()
			&& !$this->getForceOverride()
			&& file_exists($this->strRootDir . '/' . $this->getTargetPath())
			&& $this->fileObj->mtime <= filemtime($this->strRootDir . '/' . $this->getTargetPath())
		) {
			// HOOK: add custom logic
			if (isset($GLOBALS['TL_HOOKS']['executeResize']) && \is_array($GLOBALS['TL_HOOKS']['executeResize']))
			{
				foreach ($GLOBALS['TL_HOOKS']['executeResize'] as $callback)
				{
					$return = System::importStatic($callback[0])->{$callback[1]}($this);

					if (\is_string($return))
					{
						$this->resizedPath = System::urlEncode($return);

						return $this;
					}
				}
			}

			$this->resizedPath = System::urlEncode($this->getTargetPath());

			return $this;
		}

		$image = System::getContainer()
			->get('contao.image.resizer')
			->resize(
				$image,
				$resizeConfig,
				(new ResizeOptions())
					->setImagineOptions(System::getContainer()->getParameter('contao.image.imagine_options'))
					->setTargetPath($this->targetPath ? $this->strRootDir . '/' . $this->targetPath : null)
					->setBypassCache(System::getContainer()->getParameter('contao.image.bypass_cache'))
			)
		;

		$this->resizedPath = $image->getUrl($this->strRootDir);

		return $this;
	}
Resize the image

@return $this The image object