2013-10-29 03:09:52 +00:00
|
|
|
<!DOCTYPE html>
|
2010-07-01 20:14:12 +00:00
|
|
|
<?php
|
2010-07-06 13:57:05 +00:00
|
|
|
/*
|
|
|
|
* fileopen.php
|
|
|
|
* To be used with ext-server_opensave.js for SVG-edit
|
|
|
|
*
|
2012-09-16 18:53:27 +00:00
|
|
|
* Licensed under the MIT License
|
2010-07-06 13:57:05 +00:00
|
|
|
*
|
|
|
|
* Copyright(c) 2010 Alexis Deveria
|
|
|
|
*
|
|
|
|
*/
|
2010-07-01 20:14:12 +00:00
|
|
|
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
|
|
|
|
// return it to the editor
|
2010-07-05 15:38:06 +00:00
|
|
|
|
|
|
|
$file = $_FILES['svg_file']['tmp_name'];
|
|
|
|
|
|
|
|
$output = file_get_contents($file);
|
|
|
|
|
|
|
|
$type = $_REQUEST['type'];
|
2013-10-29 06:54:31 +00:00
|
|
|
if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) {
|
|
|
|
exit;
|
|
|
|
}
|
2010-07-05 15:38:06 +00:00
|
|
|
|
|
|
|
$prefix = '';
|
|
|
|
|
|
|
|
// Make Data URL prefix for import image
|
|
|
|
if($type == 'import_img') {
|
|
|
|
$info = getimagesize($file);
|
|
|
|
$prefix = 'data:' . $info['mime'] . ';base64,';
|
|
|
|
}
|
2010-07-01 20:14:12 +00:00
|
|
|
?>
|
2013-10-29 03:09:52 +00:00
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2010-07-01 20:14:12 +00:00
|
|
|
<script>
|
2013-10-29 06:13:33 +00:00
|
|
|
window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo $type; ?>");
|
2012-05-08 20:09:38 +00:00
|
|
|
</script>
|
2013-10-29 03:09:52 +00:00
|
|
|
</head><body></body>
|
|
|
|
</html>
|