/**
  * Removes all image versions
  *
  * @param IdEntity $entity
  */
 public function removeImageVersions(IdEntity $entity)
 {
     foreach ($this->imageSizes as $size => $maximumDimensions) {
         if (is_file($filePath = $this->pathService->getFileSystemPath($entity, $size))) {
             @unlink($filePath);
         }
     }
 }
 /**
  * Constructs a new simple sized path service
  *
  * @param \Symfony\Component\HttpKernel\KernelInterface $kernel
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param string $relativePath the relative path from the web dir
  * @param string $imageType the image type, on of the ImageHandler::IMAGE_TYPE_* constants
  * @param string|null $hashPrefix prefix for file name hashing. No hashing is applied to the filename, if $hashPrefix is null
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(KernelInterface $kernel, Request $request, $relativePath, $imageType, $hashPrefix = null)
 {
     parent::__construct($kernel, $request);
     if (!ImageHandler::isSupportedImageType($imageType)) {
         throw new \InvalidArgumentException("Image type not supported: {$imageType}. Supported image types are: " . implode(", ", ImageHandler::getSupportedImageTypes()));
     }
     $this->imageType = $imageType;
     $this->hashPrefix = $hashPrefix;
     $this->relativePath = trim($relativePath, "/");
 }