Javascript – get extension from base64 image

A bit late but it seem the question was misunderstood. He just only had the base64 content of the image, not the full data URI.

I wrote here for anyone who encounters with this quest, you can read the first character of content content.charAt(0). By base64 image content if the first char is:

“https://stackoverflow.com/” : jpg

‘i’ : png

‘R’ : gif

‘U’ : webp

So for your case, it is ‘jpg’.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)