Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncphp
/
mcClasses
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 365df977
authored
Nov 27, 2013
by
sn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inkscape
1 parent
7464c916
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
file/class_mcFile.inc.php
file/class_mcInkscape.inc.php
file/class_mcFile.inc.php
View file @
365df97
...
...
@@ -23,12 +23,10 @@ class mcFile {
@
$var_file
=
fopen
(
$param_filename
,
$param_kindof
);
if
(
$var_file
===
false
)
{
return
false
;
}
else
{
fputs
(
$var_file
,
$param_text
);
fputs
(
$var_file
,
mcCONST
::
LINEBREAK
.
mcCONST
::
LINEBREAK
);
//
fputs($var_file, mcCONST::LINEBREAK.mcCONST::LINEBREAK);
}
fclose
(
$var_file
);
return
true
;
...
...
file/class_mcInkscape.inc.php
View file @
365df97
...
...
@@ -18,11 +18,29 @@ class mcInkscape {
$inkscape_order
=
"inkscape
$param_in_svg
-e
$param_out_png
"
;
$shell_exec
=
shell_exec
(
$inkscape_order
);
D
::
show
(
$shell_exec
,
$inkscape_order
);
return
$param_out_png
;
}
/**
*
* @param string $param_svgFileString
*/
public
static
function
svgToPdf
(
$param_in_svg
,
$param_out_pdf
=
false
)
{
if
(
$param_out_pdf
===
false
)
{
$param_out_pdf
=
tempnam
(
"/tmp"
,
"mcInkscape_"
);
$tmp_png
=
$param_out_pdf
.
'.pdf'
;
mcFile
::
rename
(
$param_out_pdf
,
$tmp_png
);
$param_out_pdf
=
$tmp_png
;
}
$inkscape_order
=
"inkscape
$param_in_svg
-A
$param_out_pdf
"
;
$shell_exec
=
shell_exec
(
$inkscape_order
);
return
$param_out_pdf
;
}
public
static
function
svgToJpg
(
$param_in_svg
,
$param_out_jpg
=
false
,
$param_quality
=
100
)
{
$new_png
=
mcInkscape
::
svgToPng
(
$param_in_svg
);
// D::li('1.1 $new_png: '.$new_png);
...
...
@@ -31,4 +49,25 @@ class mcInkscape {
}
class
mcCairoSvg
{
/**
*
* @param string $param_svgFileString
*/
public
static
function
svgToPdf
(
$param_in_svg
,
$param_out_pdf
=
false
)
{
if
(
$param_out_pdf
===
false
)
{
$param_out_pdf
=
tempnam
(
"/tmp"
,
"mcInkscape_"
);
$tmp_png
=
$param_out_pdf
.
'.pdf'
;
mcFile
::
rename
(
$param_out_pdf
,
$tmp_png
);
$param_out_pdf
=
$tmp_png
;
}
$inkscape_order
=
"cairosvg.sh
$param_in_svg
$param_out_pdf
"
;
$shell_exec
=
shell_exec
(
$inkscape_order
);
return
$param_out_pdf
;
}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment