I am facing a major issue in encoding/decoding a base 64 image.
My purpose is to save a canvas image as base64 decoded string that can later be base64 encoded in php.
I have the javascript code as follows:
var string= canvas.toDataURL("image/jpeg");
var abc = window.atob(string.split(",")[1]);
var blob = "HEADERS"+abc;
blob is the file.
PHP code:
$Data = blob File
$img = substr($Data, $start, $end);
$img = base64_encode($img);
I start when I find chr(0xFF) . chr(0xD8) in the blob file and end when I find chr(0xFF) . chr(0xD9)
These characters are not found when I decode through javascript but easily gets found when using base64_decode of php. There is a problem of encoding type I think and I'm a novice in the encoding methods. so kindly help.