mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
Trim svg importé
This commit is contained in:
parent
5be1947006
commit
4eebe0df75
9
app.php
9
app.php
@ -84,18 +84,13 @@ $f3->route('POST /image2svg',
|
|||||||
$f3->error(403);
|
$f3->error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Web::instance()->mime($imageFile, true) == 'image/svg+xml') {
|
|
||||||
header('Content-Type: image/svg+xml');
|
|
||||||
echo file_get_contents($imageFile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_exec(sprintf("convert -background white -flatten %s %s", $imageFile, $imageFile.".bmp"));
|
shell_exec(sprintf("convert -background white -flatten %s %s", $imageFile, $imageFile.".bmp"));
|
||||||
shell_exec(sprintf("mkbitmap -x -f 8 %s -o %s", $imageFile.".bmp", $imageFile.".bpm"));
|
shell_exec(sprintf("mkbitmap -x -f 8 %s -o %s", $imageFile.".bmp", $imageFile.".bpm"));
|
||||||
shell_exec(sprintf("potrace --svg %s -o %s", $imageFile.".bpm", $imageFile.".svg"));
|
shell_exec(sprintf("potrace --svg %s -o %s", $imageFile.".bpm", $imageFile.".svg"));
|
||||||
|
shell_exec(sprintf("convert -trim %s %s", $imageFile.".svg", $imageFile."-trim.svg"));
|
||||||
|
|
||||||
header('Content-Type: image/svg+xml');
|
header('Content-Type: image/svg+xml');
|
||||||
echo file_get_contents($imageFile.".svg");
|
echo file_get_contents($imageFile."-trim.svg");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$f3->route('POST /@key/save',
|
$f3->route('POST /@key/save',
|
||||||
|
Loading…
Reference in New Issue
Block a user