User posts Ulder91
02 August 2019 13:53
27 February 2018 21:09
Hello,
I'm trying to save, on a folder in my server, the image of all my canvas, using ajax (after click on a button):
$( ".save" ).click(function() {
var c = document.getElementById('canvasID');
var dataURL = c.toDataURL("image/jpeg");
$.ajax({
type: "POST",
url: "save-image.php",
data: {
imgBase64: dataURL
}
});
});
where save-image.php is:
define('UPLOAD_DIR', 'images-canvas/');
$img = $_POST['imgBase64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
but the image saved is always black. Why? Anyone can help me, please?
Thank you!
I'm trying to save, on a folder in my server, the image of all my canvas, using ajax (after click on a button):
$( ".save" ).click(function() {
var c = document.getElementById('canvasID');
var dataURL = c.toDataURL("image/jpeg");
$.ajax({
type: "POST",
url: "save-image.php",
data: {
imgBase64: dataURL
}
});
});
where save-image.php is:
define('UPLOAD_DIR', 'images-canvas/');
$img = $_POST['imgBase64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
but the image saved is always black. Why? Anyone can help me, please?
Thank you!
06 September 2017 12:42
Hi guys, I also did some tests with the yuri file, and I understand a few things. it worked, but I still have some issues that I do not think are solvable.
First I have to match the flare with the sun of an environment map and even if I position it exactly in the sun position, the flare appears moved.
Finally the map environment is mapped to a semisphere that rotates slowly, so I should relate the flare with the semisphere, but if I do it the flare disappears.
I do not think there is a solution, or I'm wrong?
First I have to match the flare with the sun of an environment map and even if I position it exactly in the sun position, the flare appears moved.
Finally the map environment is mapped to a semisphere that rotates slowly, so I should relate the flare with the semisphere, but if I do it the flare disappears.
I do not think there is a solution, or I'm wrong?
05 September 2017 16:26
05 September 2017 16:11
Thank you su much for your reply.
This is the explanation found in the manual.
Lens Flare object is used for the actual rendering of the effect. In essence, such an object consists of several planes with each plane containing one element of the flare. The normal vector of each plane should be pointed in the -Y direction. Every element can slide across the screen in relation to camera rotation with the sole exception being the central plane (bright white “star” on the picture above). This plane serves as a center of the lens flare object and should have a local Y coordinate set to 1.
The placement and spatial orientation of the object itself are not taken into account during rendering.
For lens flare object to work correctly, the Disable Frustum Culling option should be activated.
An example of such object can be seen, for example, in our Island demo.
This is the explanation found in the manual.
Lens Flare object is used for the actual rendering of the effect. In essence, such an object consists of several planes with each plane containing one element of the flare. The normal vector of each plane should be pointed in the -Y direction. Every element can slide across the screen in relation to camera rotation with the sole exception being the central plane (bright white “star” on the picture above). This plane serves as a center of the lens flare object and should have a local Y coordinate set to 1.
The placement and spatial orientation of the object itself are not taken into account during rendering.
For lens flare object to work correctly, the Disable Frustum Culling option should be activated.
An example of such object can be seen, for example, in our Island demo.
05 September 2017 15:24