开发者

Display MySQL BLOB'd image on webpage without separate script (PHP)

开发者 https://www.devze.com 2022-12-22 00:43 出处:网络
So I\'ve got some images stored in a MySQL database as BLOB\'s (I know it\'s better to just store the directory and do it that way, but this is what I need to do for now) and I need to display them on

So I've got some images stored in a MySQL database as BLOB's (I know it's better to just store the directory and do it that way, but this is what I need to do for now) and I need to display them on a webpage. Now, I know how to make a script and give it an image header and pull the img src from there, but I have a lot of images from diffe开发者_开发问答rent places for different uses, so I'd have to make a ton of these scripts and I'd rather not clutter up my files like that. Anyway, does anyone know of a function or something I can use to display the image that will run on the same page?


This is what I've done in php to call an image stored a blob in mysql

img width=120 height=120 src="data:image/png;base64,'.base64_encode($row['Image']).'


Use a data: URI to hold the image.

0

精彩评论

暂无评论...
验证码 换一张
取 消