public static function getSrcPath(string $path, string $file = null, string $width = null, string $height = null, array $flags = [], int $quality = null): string
    {
        $cacheName = 'getSrcPath' . $path . $file . $width . $height . implode($flags) . $quality;
        $destination = (self::$parameters['cache'] ? self::$cache->load($cacheName) : null);
        if ($destination === null) {
            // create thumbnail dir
            if (!file_exists(self::$parameters['thumbPath'])) {
                throw new \Exception('Path: ' . self::$parameters['thumbPath'] . ' does not exist!');
            }

            $template = self::$parameters['template'];
            if (isset($template[$path])) {
                // resize image by template
                $conf = $template[$path];
                $destination = self::resizeImage($conf['path'], $file, $conf['width'] ?? null, $conf['height'] ?? null, $conf['flags'] ?? [], $conf['quality'] ?? null);
            } else {
                // resize image by path
                $destination = self::resizeImage($path, $file, $width, $height, $flags, $quality);
            }

            if (self::$parameters['cache']) {   // only for cache
                try {
                    self::$cache->save($cacheName, $destination, [Cache::FILES => [self::$parameters['dir'] . $path . $file]]);
                } catch (\Throwable $e) {
                }
            }
        }
        return substr($destination, strlen(realpath(self::$parameters['dir'])) + 1);
    }