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

问题描述

我有类型的图像对象持有的形象。
我想显示MVC图像视图以及其他控制。
我能想到的办法是在磁盘上的临时存储图像和IMG控制设置SRC。
我相信会有这样做的更好的方法。

I have an object of type IMAGE which holds image.I wanted to display the image in MVC view along with other controls.The way i can think of is to temporary store image on disk and set src of img control.I am sure there would be better way of doing this.

推荐答案

您可以编写一个处理流出来的图像,然后引用流光在你的形象标签。

You can write a handler to stream images out and then reference the streamer in your image tag.

例如,您有流出来的图像。在您的网页时引用就像这样:
< IMG SRC =HTTP://myapp/media.ashx imageId = 10/>

For instance, you have http://myapp/media.ashx?imageId=10 stream out the image. In your page you reference like so:<img src="http://myapp/media.ashx?imageId=10"/>.

这样,您就不必临时写入到磁盘中。

This way you don't have to temporarily write to disk.

这篇关于从MVC图像对象显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:48
查看更多