public function getImageSize($file, $force = false)
    {
        $cache = false;
        if ($this->container->has('nyrodev_image_cache')) {
            $cache = $this->get('nyrodev_image_cache');
        }

        $cacheKey = 'imageSize_'.sha1($file);
        $imageSize = [];

        if ($force || !$cache || !$cache->contains($cacheKey)) {
            try {
                $fs = new Filesystem();
                if (filter_var($file, FILTER_VALIDATE_URL) || $fs->exists($file)) {
                    $imageSize = @getimagesize($file);
                    if (is_array($imageSize) && count($imageSize) && $cache) {
                        $cache->save($cacheKey, $imageSize, 24 * 60 * 60); // cache for 24 hours
                    }
                }
            } catch (\Exception $ex) {
            }
        } else {
            $imageSize = $cache->fetch($cacheKey);
        }

        return $imageSize;
    }