Convert image to base64 without canvas

后端 未结 2 659
萌比男神i
萌比男神i 2021-01-22 22:59

I need to convert an image to base64 encoding. I know its very easy with canvas. but the problem is that it should also run in IE8. but IE8 dont support HTML5 so i can\'t do it

2条回答
  •  孤城傲影
    2021-01-22 23:25

    Simple answer is no if this needs to be done on client side. The canvas element is the only way to convert an image to bitmap data or data-uris (and even then security restriction may apply preventing this).

    You can maybe get around this using Flash but of course that would require the client to have Flash installed.

    Or setting up an external web service where you can upload the image and have it return the data you need.

    For IE8 and lower there are no options out of the box (exCanvas gives you canvas drawing capabilities but can't provide bitmap data which is needed here). Basically, for IE8 you will need a server.

提交回复
热议问题