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 2cbd6db8
authored
Jun 12, 2014
by
vuj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Textfeld flowpara und flowspan
1 parent
6e4364e6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
17 deletions
file/class_mcInkscape.inc.php
file/class_mcInkscape.inc.php
View file @
2cbd6db
...
...
@@ -6,10 +6,11 @@ class mcInkscape {
*
* @param string $param_svgFileString
*/
public
static
function
svgToPng
(
$param_input_filename
,
array
$param_outputfile
=
null
,
array
$param_quality
=
null
)
{
public
static
function
svgToPng
(
$param_input_filename
,
array
$param_outputfile
=
null
,
array
$param_quality
=
null
)
{
self
::
replaceInSvGFile
(
$param_input_filename
);
mcFile
::
manipulateOutputfileArray
(
$param_outputfile
,
$param_input_filename
);
if
(
!
$param_outputfile
[
'filename'
])
{
if
(
!
$param_outputfile
[
'filenameextension'
])
{
if
(
!
$param_outputfile
[
'filename'
])
{
if
(
!
$param_outputfile
[
'filenameextension'
])
{
$param_outputfile
[
'filenameextension'
]
=
'.png'
;
}
$outfile
=
mcFile
::
createTmpFile
(
$param_outputfile
);
...
...
@@ -17,11 +18,11 @@ class mcInkscape {
$outfile
=
$param_outputfile
[
'filename'
];
}
if
(
!
$param_quality
[
'dpi'
])
{
if
(
!
$param_quality
[
'dpi'
])
{
$param_quality
[
'dpi'
]
=
90
;
}
$order
=
"inkscape
$param_input_filename
--export-dpi="
.
$param_quality
[
'dpi'
]
.
" -e
$outfile
"
;
$order
=
"inkscape
$param_input_filename
--export-dpi="
.
$param_quality
[
'dpi'
]
.
" -e
$outfile
"
;
// D::ulli('$'.$order);
// $shell_exec = shell_exec($order);
$shell_exec
=
mcBash
::
shell_exec
(
$order
);
...
...
@@ -33,10 +34,10 @@ class mcInkscape {
*
* @param string $param_svgFileString
*/
public
static
function
svgToPdf
(
$param_input_filename
,
array
$param_outputfile
=
null
,
array
$param_quality
=
null
)
{
public
static
function
svgToPdf
(
$param_input_filename
,
array
$param_outputfile
=
null
,
array
$param_quality
=
null
)
{
mcFile
::
manipulateOutputfileArray
(
$param_outputfile
,
$param_input_filename
);
if
(
!
$param_outputfile
[
'filename'
])
{
if
(
!
$param_outputfile
[
'filenameextension'
])
{
if
(
!
$param_outputfile
[
'filename'
])
{
if
(
!
$param_outputfile
[
'filenameextension'
])
{
$param_outputfile
[
'filenameextension'
]
=
'.pdf'
;
}
...
...
@@ -45,15 +46,15 @@ class mcInkscape {
$outfile
=
$param_outputfile
[
'filename'
];
}
if
(
!
$param_quality
[
'DPI'
])
{
if
(
!
$param_quality
[
'DPI'
])
{
$param_quality
[
'DPI'
]
=
90
;
}
if
(
!
$param_quality
[
'PDF_VERSION'
])
{
if
(
!
$param_quality
[
'PDF_VERSION'
])
{
$param_quality
[
'PDF_VERSION'
]
=
1.4
;
}
$order
=
"inkscape
$param_input_filename
--export-dpi="
.
$param_quality
[
'dpi'
]
.
" --export-pdf=
$outfile
"
;
$order
=
"inkscape
$param_input_filename
--export-dpi="
.
$param_quality
[
'dpi'
]
.
" --export-pdf=
$outfile
"
;
// D::ulli('$'.$order);
// $shell_exec = shell_exec($order);
$shell_exec
=
mcBash
::
shell_exec
(
$order
);
...
...
@@ -61,18 +62,18 @@ class mcInkscape {
return
$outfile
;
}
public
static
function
svgToJpg
(
$param_in_svg
,
$param_out_jpg
=
false
,
$param_quality
=
100
)
{
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);
return
mcImage
::
pngToJpg
(
$new_png
,
$param_out_jpg
,
$param_quality
);
}
public
static
function
inkscapeSvgToNormalSvg
(
$param_input_filename
,
array
$param_outputfile
=
null
)
{
self
::
replaceInSvGFile
(
$param_input_filename
);
public
static
function
inkscapeSvgToNormalSvg
(
$param_input_filename
,
array
$param_outputfile
=
null
)
{
mcFile
::
manipulateOutputfileArray
(
$param_outputfile
,
$param_input_filename
);
if
(
!
$param_outputfile
[
'filename'
])
{
if
(
!
$param_outputfile
[
'filenameextension'
])
{
if
(
!
$param_outputfile
[
'filename'
])
{
if
(
!
$param_outputfile
[
'filenameextension'
])
{
$param_outputfile
[
'filenameextension'
]
=
'.svg'
;
}
...
...
@@ -81,13 +82,26 @@ class mcInkscape {
$outfile
=
$param_outputfile
[
'filename'
];
}
$inkscape_order
=
"inkscape -T "
.
$param_input_filename
.
" -l "
.
$outfile
.
" "
;
$inkscape_order
=
"inkscape -T "
.
$param_input_filename
.
" -l "
.
$outfile
.
" "
;
$shell_exec
=
mcBash
::
shell_exec
(
$inkscape_order
);
return
$outfile
;
}
public
function
replaceInSvGFile
(
$param_input_filename
)
{
$replacearray
=
array
(
'flowpara'
=>
'flowPara'
,
'flowspan'
=>
'flowSpan'
,
);
//Mage::helper('anc_printconfigproduct/constant')->get('ancTransTagsCaseInkscape');
$str
=
implode
(
"
\n
"
,
file
(
$param_input_filename
));
$fp
=
fopen
(
$param_input_filename
,
'w'
);
foreach
(
$replacearray
as
$key
=>
$value
)
{
$str
=
str_replace
(
$key
,
$value
,
$str
);
}
fwrite
(
$fp
,
$str
,
strlen
(
$str
));
}
}
?>
\ 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