locked
Downloaded Image reference problem RRS feed

  • Question

  • We are developing a C# Windows Store application and have hit a major snag. In our application directory we have a directory and an index.html file within it which is displayed in a WebView. No problem there. However, we need to display images that the application has downloaded and stored in the ApplicationData.Current.LocalFolder. We have tried multiple variations of the following snippet to display these images:

    <img src="ms-appdata:///local/thumbGame.png" alt="" />

    Nothing. Believe me when I say we have tried many variations of the above without success. What am I missing here?

    Many thanks

    Wednesday, October 30, 2013 7:36 PM

Answers

  • Webview in windows 8 do not support display of local images. Without workaround this is not achievable. If you are looking for workaround check out this one.  

    However, in Windows 8.1 you can do this easily using NavigateToLocalStreamUri


    Thanks, Sachin



    • Edited by Sachin S Wednesday, October 30, 2013 7:59 PM
    • Marked as answer by mikepalmer_1 Wednesday, October 30, 2013 8:57 PM
    Wednesday, October 30, 2013 7:58 PM

All replies

  • Hi

    convert your Image to a base64 string and use <img src=\"data:image/png;base64,

    Use this together with WebView.NavigateToString should work like described here

    http://stackoverflow.com/questions/14376299/image-in-local-html-couldnt-be-loaded-into-webview-in-windows8


    lh

    Wednesday, October 30, 2013 7:47 PM
  • Webview in windows 8 do not support display of local images. Without workaround this is not achievable. If you are looking for workaround check out this one.  

    However, in Windows 8.1 you can do this easily using NavigateToLocalStreamUri


    Thanks, Sachin



    • Edited by Sachin S Wednesday, October 30, 2013 7:59 PM
    • Marked as answer by mikepalmer_1 Wednesday, October 30, 2013 8:57 PM
    Wednesday, October 30, 2013 7:58 PM
  • Thank you for your answer. The HTML file is not managed by C# but I can retrieve the base64 value of the image as it is downloaded. So using your solution the following <img HTML works:

    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCAYAAACb3McZAAAFYElEQVR42u3dsY7UVhSHcT/CPEG0D5Bi6lRbUlKlpuAJ8gTzBtOkQ6sVHRLFVBSRIm1BgUTDNlG6UEBHsVqaLATY+JiZZHexPTPG9ti+vyN9EjQMe+/99m+fa9/Jsob1968/zHIe5JzmvMq5BgbE2XptxhqdZX1V/mHHOSsTg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kQxtwQZ9EtSxVea1XST4rO7fII4unPmmCCDO6ghFv0+XaSuRInunDkmyGA6WPuKUSZKmzv6OlkEGcRLUnGT3+ZxO/FvtdE4iO6cOSbIwTpYbYvRtig6WQQ5TAfr6rLXwxGKy8D8M3WyCDLsDlaIkS/WQ7yxF5/ZRBSPnBCk+W/mPAWGLkalKLt2shxFSpDGx/ycn+y2yTfAd7x33WzUySJIJx2su7vfQz5sok4UL08RpPkNesn1fLRGx/guReyalwkfXTBzTZBG1/JtbvINqfFwVxTzTZDGHaypiFG3K6+TRZBGbxGm8KxSdLEIQhCAIABBAIIABAEIAhAEIAhAEAAEAXYX5MJAAKW8CkHODARQyioEWRoIoJRFCHLfQAClzLMo9yHAN7zONpX/5dSAALdY3hRkbkCAWxxlN0s3C/iP0+xuhTEGBihJjxuSLAwOkm/t1lXsHhokJLtzvq3Wl1ravkiNWPOzbJdad7VIgpTkmGf7FElAjt0kcU+Cyd5zVHas9pBk5oFGTHqnvI3K/8Fjm4mYAGeNL6n2EGVloDG23fFYu1lftb70erD+YMmCISbF6XqNzpqu838BTIL6MDYxuZsAAAAASUVORK5CYII=
    " alt="" />

    I wonder if there is any other way to do this? This works but as you can see, is rather verbose in nature. 

    Thanks again.


    Mike Palmer

    Wednesday, October 30, 2013 8:18 PM