/** * Processes the resize and executes it if not already cached. * * @param ImageInterface $image * @param ResizeConfigurationInterface $config * @param ResizeOptionsInterface $options * * @return ImageInterface */ private function processResize(ImageInterface $image, ResizeConfigurationInterface $config, ResizeOptionsInterface $options) { $coordinates = $this->calculator->calculate($config, $image->getDimensions(), $image->getImportantPart()); // Skip resizing if it would have no effect if ($coordinates->isEqualTo($image->getDimensions()->getSize()) && !$image->getDimensions()->isRelative()) { return $this->createImage($image, $image->getPath()); } $cachePath = $this->cacheDir . '/' . $this->createCachePath($image->getPath(), $coordinates); if ($this->filesystem->exists($cachePath) && !$options->getBypassCache()) { return $this->createImage($image, $cachePath); } return $this->executeResize($image, $coordinates, $cachePath, $options); }