Skip to content

Instantly share code, notes, and snippets.

@mjunaidi
Forked from nazoking/gist:2822127
Created December 7, 2020 12:53
Show Gist options
  • Save mjunaidi/f6615cec7f6d006642aa7ee6cb9b89a0 to your computer and use it in GitHub Desktop.
Save mjunaidi/f6615cec7f6d006642aa7ee6cb9b89a0 to your computer and use it in GitHub Desktop.
get image mime type from base64
function guessImageMime(data){
if(data.charAt(0)=='/'){
return "image/jpeg";
}else if(data.charAt(0)=='R'){
return "image/gif";
}else if(data.charAt(0)=='i'){
return "image/png";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment