Current File : /home/users/barii/public_html/finansenl.com.pl/system.fotomagnesy.pl/js/saveJson.php |
<?php
$text = str_replace("\\n",chr(-164).chr(-164).'n',$_POST['json']);
$text = str_replace('null,{','{',$text);
$img = $_POST['imgBase64'];
$img = str_replace('data:image/jpeg;base64,', '', $img);
$fileData = base64_decode($img);
$fileName = $data.'.jpg';
file_put_contents('../elementy/mini/'.str_replace('imp','',$_POST['funct']).'.png', $fileData);
$image = new Imagick('../elementy/mini/'.str_replace('imp','',$_POST['funct']).'.png');
$image->setimageresolution(72, 72);
$image->scaleimage(250,0);
$image->writeimage('../elementy/mini/'.str_replace('imp','',$_POST['funct']).'.png');
$file = 'zapisanejson.js';
$function = file_get_contents($file);
$function .= '
function '.$_POST[funct].'(scale){
var json = \''.$text.'\';
canvas.loadFromJSON(json);
}';
file_put_contents($file, $function."\n");
?>