public function getUrl($file, $type): string
    {
        if (!$this->checkPermission($type)) {
            $file = $this->noImage;
        }

        $filePath = $this->getCachePath($file, $type);

        if (file_exists($filePath['system']) && (time() - filemtime($filePath['system']) < $this->cacheTime)) {
            return $filePath['public'];
        }

        return Url::toRoute([$this->imageAction, 'path' => urlencode($file), 'type' => $type]);
    }