Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/js/saveJson.php
<?php
$string = substr($_POST['dodatkowo'],15);
$tmp = explode('!',$string);
$tmp2 = explode('_',$tmp[2]);

print($tmp);
print($tmp2);

     $arr = array('.jpg','.png');  
     $arr2 = array('','');   

$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('../uploads/items/etykiety_podglad/'.$tmp[0].'/'.$tmp[1].'/'.$tmp[2], $fileData);

                $image = new Imagick('../img/butelka_'.$tmp2[0].'.png'); 
                $image->setimageresolution(72, 72);                       
                $image->scaleimage(700,0);        
                $image2 = new Imagick('../uploads/items/etykiety_podglad/'.$tmp[0].'/'.$tmp[1].'/'.$tmp[2]);  
                $image2->setimageresolution(72, 72);                       
                $image2->scaleimage(315,0);            
                $image->compositeImage($image2, imagick::COMPOSITE_OVER, 187,888);         
                $image->writeimage('../uploads/items/butelki_wizualizacja/'.$tmp[0].'/'.$tmp[1].'/'.$tmp[2]);



$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");

?>