Dad72 Posted February 5, 2017 Share Posted February 5, 2017 No this can not be changed. But you can rename after, either manually or using PHP with rename (). Quote Link to comment Share on other sites More sharing options...
JimmyBuchman Posted February 5, 2017 Share Posted February 5, 2017 oh ok them, I will try this using php, do you have any example ? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 5, 2017 Share Posted February 5, 2017 <?php //rename(oldImage, newImage) rename("root/screenshot_-2-5_14-13.png", "root/screenshot.png"); ?> Doc PHP: http://php.net/manual/en/function.rename.php Quote Link to comment Share on other sites More sharing options...
JimmyBuchman Posted February 5, 2017 Share Posted February 5, 2017 13 minutes ago, Dad72 said: <?php //rename(oldImage, newImage) rename("root/screenshot_-2-5_14-13.png", "root/screenshot.png"); ?> Doc PHP: http://php.net/manual/en/function.rename.php But the download file name is always chaging.screenshot_-2-5_14-13 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 5, 2017 Share Posted February 5, 2017 You must rename it after the file is on the server. Quote Link to comment Share on other sites More sharing options...
JimmyBuchman Posted February 5, 2017 Share Posted February 5, 2017 3 minutes ago, Dad72 said: You must rename it after the file is on the server. But when I click the button the download is already done, and the name of the download always changes, as I will know how to change. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 5, 2017 Share Posted February 5, 2017 You must learn to use PHP. Quote Link to comment Share on other sites More sharing options...
JimmyBuchman Posted February 6, 2017 Share Posted February 6, 2017 4 hours ago, Dad72 said: You must learn to use PHP. the rename(); it wasn't need it, i enter in the babylon.js find the function that make the name and change it !But one more time thanks for everything that you do for me! Dad72 1 Quote Link to comment Share on other sites More sharing options...
Laurelle Posted August 7, 2017 Share Posted August 7, 2017 There is a simpler way to rename the picture. You can find how it's done in the Babylon.js sources. BABYLON.Tools.CreateScreenshot(engine, scene.activeCamera, 640, function (base64Image) { if (("download" in document.createElement("a"))) { var a = window.document.createElement("a"); a.href = base64Image; var date = new Date(); var stringDate = YOURFILENAME; a.setAttribute("download", stringDate + ".png"); window.document.body.appendChild(a); a.addEventListener("click", () => { a.parentElement.removeChild(a); }); a.click(); //Or opening a new tab with the image if it is not possible to automatically start download. } else { var newWindow = window.open(""); var img = newWindow.document.createElement("img"); img.src = base64Image; newWindow.document.body.appendChild(img); } }); it's basically copy/paste from the source code. the stringDate is the name of your file. that's it. 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.