Skip to content

Commit

Permalink
#179. Add canvas save script gen.
Browse files Browse the repository at this point in the history
  • Loading branch information
dim-s committed Jul 23, 2017
1 parent 94b5059 commit 6ab0d02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<scriptGenerator>
<name>Сохранить рисунок</name>
<description>Сохранить нарисованное изображение canvas в файл</description>
<context>FormEditor.objectItem</context>

<source syntax="php"><![CDATA[
// Задаем путь к сохраняемой картинке ...
$filename = 'путь к jpg, png, gif';
// Создаем папку для файла, если ее нет ...
fs::ensureParent($filename);
// Сохраняем изображение в файл.
$this->#object.id#->save($filename, fs::ext($filename));
]]></source>
</scriptGenerator>
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function getScriptGenerators()
return [
new IdeLibraryScriptGeneratorResource('res://.dn/bundle/uiDesktop/scriptgen/DrawLineCanvasScriptGen'),
new IdeLibraryScriptGeneratorResource('res://.dn/bundle/uiDesktop/scriptgen/DrawSVGCanvasScriptGen'),
new IdeLibraryScriptGeneratorResource('res://.dn/bundle/uiDesktop/scriptgen/SaveImageToFileCanvasScriptGen'),
];
}
}

0 comments on commit 6ab0d02

Please sign in to comment.