Javascript - get extension from base64 image

后端 未结 8 1612

I have a base64 encoded image returned from a service and it looks like this:

/9j/4AAQSkZJRgABAQEASABIAAD/4Yp2aHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWN         


        
8条回答
  •  时光说笑
    2021-01-01 10:24

    Was just tweaking with the string. May be this could help.

    base64Data.substring("data:image/".length, base64Data.indexOf(";base64"))
    

提交回复
热议问题