swat0284 Posted November 12, 2015 Share Posted November 12, 2015 helloCan i take canvas (babylon) screen shot and save it to variable to send it to serwer like byte[]? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 12, 2015 Share Posted November 12, 2015 I think this can help. Get the texture sending Ajax to PHP:$.ajax({ url:"PHP/save.php", type:'post', data: "dir=" + path + "&img=" + textureDynamic._canvas.toDataURL()});function PHP for savedfunction saveImg($img, $finalDir) { $nameImage = "myImageName"; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = $finalDir.$nameImage.'.png'; chmod($file, 0777); $success = file_put_contents($file, $data); $im = imagecreatefrompng($file); imagepng($im, $file, 9); chmod($file, 0644); }saveImg($_POST['img'], $_POST['path']); Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 12, 2015 Share Posted November 12, 2015 Or you can try this.It have a callback function too, where you can sent the variable to the server.Tools.CreateScreenshot = function (engine, camera, size, successCallback) { Like this (check console) swat0284 1 Quote Link to comment Share on other sites More sharing options...
swat0284 Posted November 12, 2015 Author Share Posted November 12, 2015 New version of babylon have got this feauter. I didnt know. ThenkYou bulisor Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 13, 2015 Share Posted November 13, 2015 I think I did not understand the question. but I tried. you're welcome. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.