base64 encode image blob not showing in IE

2019-03-06 03:32发布

  echo '<img src="data:image/jpg/png/jpeg;base64,' . base64_encode( $row['image'] ) . '" height="150" />';

This is showing up images great in firefox, safari and chrome, but in internet explorer it shows a nice red cross, and I assume it is because of the encoding?

2条回答
甜甜的少女心
2楼-- · 2019-03-06 03:40

Most likely old IE or too big image for IE8.

IE7 and below definitely don't support it. IE9 support inline images just fine. I IE8 have limited support. - Check out http://en.wikipedia.org/wiki/Data_URI_scheme for list.

查看更多
疯言疯语
3楼-- · 2019-03-06 03:55

Try replacing data:image/jpg/png/jpeg; with either data:image/jpeg; or data:image/png; depending on the format of the image. You can't expect it to be both a PNG and a JPEG.

查看更多
登录 后发表回答