Admin_PageController::uploadScreenshotAction PHP Метод

uploadScreenshotAction() публичный Метод

    public function uploadScreenshotAction()
    {
        if ($this->getParam("data") && $this->getParam("id")) {
            $data = substr($this->getParam("data"), strpos($this->getParam("data"), ",") + 1);
            $data = base64_decode($data);
            $file = PIMCORE_TEMPORARY_DIRECTORY . "/document-page-previews/document-page-screenshot-" . $this->getParam("id") . ".jpg";
            $dir = dirname($file);
            if (!is_dir($dir)) {
                File::mkdir($dir);
            }
            File::put($file, $data);
        }
        $this->_helper->json(["success" => true]);
    }