locked
showing image from local storage in html page RRS feed

  • General discussion

  • i want to show image from local storage in html page. for that i have created a webview in the xaml file and on click event of button i am showing the html page in which i need to show the image .

    I am giving the absolute path in the html page to fetch the image from local storage but that will not work on every machine. Is there any way to show the image of local storage on this html page without giving the absolute path.


    singh123456

    Monday, January 7, 2013 9:32 AM

All replies

  • so ..no one can answer this question.......?

    singh123456

    Tuesday, January 8, 2013 6:16 AM
  • i want to show image from local storage in html page. for that i have created a webview in the xaml file and on click event of button i am showing the html page in which i need to show the image .

    I am giving the absolute path in the html page to fetch the image from local storage but that will not work on every machine. Is there any way to show the image of local storage on this html page without giving the absolute path.


    singh123456



    singh123456

    Tuesday, January 8, 2013 6:20 AM
  • me too faced the same problem, could any experts give a solution for this?

    sankar


    • Edited by sankarann Tuesday, January 8, 2013 6:49 AM
    Tuesday, January 8, 2013 6:49 AM
  • Hi,

    We can use ms-appx-web:///Assets/test.jpg to assign the local image, and use webview to navigate to string.

            private void Button_Click_1(object sender, RoutedEventArgs e)
            {
                string _htmlFragment =
                    @"
                    <html>
                        <head>        
                            <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>                        
                        </head>
                        <body >                        
                            <img src='ms-appx-web:///Assets/2.jpg' alt='picture test'/>
                        </body>
                    </html>";
                mywebview.NavigateToString(_htmlFragment);
            }

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 8, 2013 7:44 AM
  • hi jesse ,

                  I have already tried this one ....this will definitely work ..but my requirement is to show the image of local storage of the system..not the image that is available in the app


    singh123456

    Tuesday, January 8, 2013 8:36 AM
  • As Windows Store App is running in the sandbox, we cannot assign a system image directly to webview, even in the XAML image source with schemes.
    Please check this document about schemes.
    http://msdn.microsoft.com/en-us/library/windows/apps/hh781215.aspx

    We can copy the image to application data folder, so that we can use 'ms-appdata' to access it.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 8, 2013 9:25 AM