在Windows Phone 7应用程序中,我正在Web浏览器中加载HTML文件.HTML文件中包含照片,必须从独立存储中加载图像(已存储)。任何人都可以指导我(是否有任何示例或在线教程)。
You could always convert the image to base64 and include the base64 as text in the document.
An example I quickly created can be viewed here: http://jsfiddle.net/NLxdB/
After you have your image as base64 you can add it in html like following: <img src="data:image/png;base64, BASE64IMAGE" />
where you replace BASE64IMAGE with you base64 string.
( EDIT: data:image/png
needs to be replaced with jpg/gif or what ever the image type is.)
To get a base64 of your image you could use the following code:
string base64 = null;
using (var iso = IsolatedStorageFile.GetUserStoreForApplication())
using (var isf = iso.OpenFile(imageName, FileMode.Open, FileAccess.Read))
using (var ms = new MemoryStream())
{
isf.CopyTo(ms);
base64 = Convert.ToBase64String(ms.ToArray());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.