Base64 Image
When converting an image to Base64 for API requests, you must remove the data:
scheme and media type prefix (e.g., data:image/jpg;base64,
).
Example
// Example: Remove the prefix from a Base64 string
const base64StringWithPrefix = "data:image/jpg;base64,...";
const base64String = base64StringWithPrefix.split(",").pop();
// Now 'base64String' contains only the Base64 encoded data
console.log(base64String);