I currently have an API running to implement Signotec Signing capabilities. They have this code:
if (value.file !== undefined) {
document.getElementById("Signature_0").src = "data:image/png;base64," + value.file;
}
to set the img element with the value.file.
I would like to save that file as png on my Server, i would use this code:
// Retrieve the image data from the JavaScript file
$imageData = $request->input('file');
// Decode the Base64-encoded data
$decodedImage = base64_decode($imageData);
// Save the image file to storage
$path = Storage::put('public/signatures/signature.png', $decodedImage);
// Return the path to the saved image
return response()->json(['path' => $path]);
and then save the $path into my purchase database. Is this correct? And how would I do this correctly?
Whatever library you're using doesn't matter, you're the one sending base64