const result = arr.reduce((acc, n, i) => (
acc.push(...(i & 1 ? n : [...n].reverse())),
acc
), []);
for (let i = 0; i < arr.length; ++i) {
const a = i & 1 ? arr[i] : [...arr[i]].reverse();
for (let j = 0; j < a.length; ++j) {
result.push(a[j]);
}
}
img {
-webkit-filter: grayscale(100%); /*для safari 6.0 - 9.0 */
filter: grayscale(100%);
}
var canvas = document.getElementById('myCanvas');
var dataURL = canvas.toDataURL();
$.ajax({
type: "POST",
url: "script.php",
data: {
imgBase64: dataURL
}
});
$img = $_POST['imgBase64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$fileData = base64_decode($img);
$fileName = 'photo.png';
file_put_contents($fileName, $fileData);