2010-07-01 20:14:12 +00:00
|
|
|
<!doctype html>
|
|
|
|
<?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'];
|
|
|
|
|
|
|
|
$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
|
|
|
?>
|
|
|
|
<script>
|
2012-05-08 20:09:38 +00:00
|
|
|
window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo htmlentities($type); ?>");
|
|
|
|
</script>
|