在图像控制中显示图像的问题 [英] problem with showing image in image control

查看:77
本文介绍了在图像控制中显示图像的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友。



i在asp.net的图像控件中显示转换为byte的图像时出现问题。



i可以从数据库中读取数据,但我无法在图像控制中显示它。

实际上我不知道我必须使用哪个URL来保存这个图像。



感谢您的帮助。

Hi friends.

i have a problem with showing image that is converted to byte in the image control of asp.net.

i can read data from database but i can not show it in image control.
in fact i do not know what url i must use for this image.

thanks for your helping.

推荐答案

您是否尝试在Google中搜索过此内容?

如果我正确理解了您的问题,互联网上有很多解决方案。



查看以下链接

http://www.aspsnippets.com/Articles/Display-Images-from-SQL-Server-Database-using-ASP.Net.aspx [ ^ ]



http://stackoverflow.com/questions/11284217/how-can-i-display-an-image-from-sql-server-using-asp-net [ ^ ]
Have you tried searching this in Google?
If I correctly understood your problem, there are so many solutions available on the Internet.

Check following links
http://www.aspsnippets.com/Articles/Display-Images-from-SQL-Server-Database-using-ASP.Net.aspx[^]

http://stackoverflow.com/questions/11284217/how-can-i-display-an-image-from-sql-server-using-asp-net[^]


Hi
您可以从数据库中读取图像数据,然后使用以下代码将其转换为流



Hi You can read the image data from database then you can convert it into stream using following code

MemoryStream stream = new MemoryStream(YourImageData);
pictureBox1.Image = Image.FromStream(stream);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;





谢谢



Thanks


你好,



您可以这样使用:



Hi,

You can rather use like this:

image.src="data:image/png;base64,"+Convert.ToBase64String(imageBytes);





在这种情况下,字节数据将被自动转换为图像源数据。为了更好地理解,请访问此处



谢谢

Sisir Patro



In this case the byte data will be atomatically casted to image source data. For better understanding follow here.

Thanks
Sisir Patro


这篇关于在图像控制中显示图像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆