使用 jquery 显示 byte[] 图像
当单击拇指图像时,我必须在同一视图的 div 中以实际大小显示图像。我将解释我的情况。我正在使用 asp.net mvc 2 应用程序。在我看来,我有图像的缩略图,这些图像作为 byte[] 存储在数据库中,并且 fileId 作为隐藏字段。单击缩略图时,我需要显示存储在数据库中的实际图像。实际图像应显示在同一视图中的 div 中,单击缩略图时应显示该视图。这应该使用 jquery 来实现。 感谢您对此进行调查。
I have to show the image in its actual size in a div in the same view when clicked on its thumb image. I will explain my scenario. I am using asp.net mvc 2 application. In my view I have thumb images of images which is stored in database as byte[] and also the fileId as hidden field. When clicked on the thumb image I need to show the actual image that is stored in the database.The actual image should be shown in a div in the same view which should be shown when click on thumb image. This should happen using jquery.
Thanks for looking into this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
HttpHandler
来实现此目的。向您的项目添加一个通用处理程序,并在 ProcessRequest 方法中执行类似以下操作然后在您的 html 中您将能够通过以下方式调用它:
You can use a
HttpHandler
for this. Add a generic handler to your project and do something like the following in theProcessRequest
methodThen in your html you will be able to call this by...
如果数据库中的图像是字节格式的,那么首先需要将图像保存在服务器目录中,保存图像文件后,借助jquery将其显示。您还可以使用灯箱等插件以更具吸引力的方式显示图像。
这样,您将能够在使用 jquery 并发出 AJAX 请求来获取图像的同一视图上显示图像。
If you images in byte format in database, then you first need to save the image in a server directory and after saving the image file, display it with the help of jquery. You can also use plugins like lightbox to display the image in a more attractive way.
This way you will be able to show the image on the same view as you are using jquery and making an AJAX request to get the image.