fileService = $fileService; $this->thumbnailGenerator = $thumbnailGenerator; } public function generateFromFile($source, $width, $height) { $target = $source . '-thumb' . $width . 'x' . $height . '.jpg'; if (!$this->fileService->exists($target)) { $fullSource = $this->fileService->getFullPath($source); $fullTarget = $this->fileService->getFullPath($target); $this->thumbnailGenerator->generateFromFile($fullSource, $fullTarget, $width, $height); } return $target; } }