Pimcore\Document\Adapter\Ghostscript::saveImage PHP Method

saveImage() public method

public saveImage ( $path, integer $page = 1, $resolution = 200 )
$path
$page integer
    public function saveImage($path, $page = 1, $resolution = 200)
    {
        try {
            $realTargetPath = null;
            if (!stream_is_local($path)) {
                $realTargetPath = $path;
                $path = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/ghostscript-tmp-" . uniqid() . "." . File::getFileExtension($path);
            }
            Console::exec(self::getGhostscriptCli() . " -sDEVICE=png16m -dFirstPage=" . $page . " -dLastPage=" . $page . " -r" . $resolution . " -o " . escapeshellarg($path) . " " . escapeshellarg($this->path), null, 240);
            if ($realTargetPath) {
                File::rename($path, $realTargetPath);
            }
            return $this;
        } catch (\Exception $e) {
            Logger::error($e);
            return false;
        }
    }