Jarves\Twig\FileExtension::thumbnail PHP Method

thumbnail() public method

public thumbnail ( integer | string $id, integer $maxWidth = 100, integer $maxHeight = 100, $quality = 8, boolean $resize = true ) : string
$id integer | string path or file id
$maxWidth integer
$maxHeight integer
$resize boolean
return string
    public function thumbnail($id, $maxWidth = 100, $maxHeight = 100, $quality = 8, $resize = true)
    {
        $path = $this->webFilesystem->getPath($id);
        $cacheDir = 'cache/rendered-image/' . $path;
        //@todo handle cacche
        $image = $this->webFilesystem->getThumbnail($path, $maxWidth . 'x' . $maxHeight);
        $this->webFilesystem->writeImage($image, $cacheDir, $quality);
        return $cacheDir;
    }