简体   繁体   English

VB.NET将嵌入式对象src设置为字节数组? 动态设置src值

[英]VB.NET set embedded object src to byte array? dynamically set src value

I am trying to dynamically set the src attribute inside of embed tags which is in turn inside object tags: 我正在尝试在嵌入标签内动态设置src属性,而嵌入标签又在对象标签内:

<object width=700 height=700>
<embed src=__bytearraycontents___ type="image/vnd.djvu" width="700" height="700" />
</object>

When I obtain the byte array and save the image file to test.djvu on my harddrive and then set the src to this, it works fine. 当我获得字节数组并将映像文件保存到硬盘驱动器上的test.djvu并将src设置为此时,它工作正常。 My problem is that I don't want to have to write the image to the hard drive, I want the src to be set to the Byte array straight away. 我的问题是我不想将图像写入硬盘,我希望将src立即设置为Byte数组。 Can anyone advise? 有人可以建议吗?

Thanks, C 谢谢,C

Set the src attribute to a page that returns .djvu files. 将src属性设置为返回.djvu文件的页面。 The page can be an .aspx or a HTTP Handler . 该页面可以是.aspx或HTTP处理程序 Pass in your unique identifier in the query string in the url in the src. 在src网址中的查询字符串中传递您的唯一标识符。 On your document serving page, make sure the Response.ContentType is "image/x.djvu". 在您的文档投放页面上,确保Response.ContentType为“ image / x.djvu”。

Example: 例:

<embed src="YourPageThatServesUpDocuments.aspx?DocumentID=1" type="image/vnd.djvu" width="700" height="700" />

Hypothetical Crude Example of YourPageThatServesUpDocuments.aspx's Page Load: YourPageThatServesUpDocuments.aspx页面加载的假设粗略示例:

Response.ContentType = "image/x.djvu"
'Where GetByteArrayByDocumentID is the code that gets your byte array.
Response.BinaryWrite(GetByteArrayByDocumentID(Request.QueryString("DocumentID")))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM