locked
couldn't load scaled images from appdata folder

    Question

  • My app saves scaled images in the local application data folder.  But those images are not loading.

    var filename = "image1.png";
    imgelement.src = "ms-appdata:///local/images/" + filename;

    the images folder in localdata folder contains the files image1.scale-100.png, image1.scale-140.png and image1.scale-180.png

    I can verify it by going to the "username\appdata\local\packages\packagename\LocalState\images".

    If I copy the same files in to the app package images folder and if I set the imgelement like

    imgelement.src = "/images/" + filename;

    the image is loading.

    Why are scaled images from local application data folder not loading, while the same images are loading from the package?


    • Edited by ner9G Monday, October 06, 2014 4:21 PM
    Monday, October 06, 2014 4:16 PM

All replies

  • Try ms-appx:///
    Also, see http://msdn.microsoft.com/en-us/library/windows/apps/Hh781215.aspx

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, October 06, 2014 7:06 PM
    Moderator
  • Thanks Matt, but my problem is the image is not loading from "ms-appdata:///local/images" folder.

    I am programmatically saving scaled images in application data in my app.

    Only scaled images like image1.scale-100.png, image1.scale-140.png and image1.scale-180.png are not loading when an image tag src set to "ms-appdata:///local/images/image1.png"

    Unscaled images are loading fine.

    Just to make sure nothing is wrong with the generated image files, I copied those files in to the package. Now when src set to "ms-appx:///images/image1.png" or "/images/image1.png" the scaled image is loading.

    What I want is the generated scaled image files to load from application data.

     

    Tuesday, October 07, 2014 2:45 AM
  • Please provide a reproduction app.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, October 07, 2014 5:26 PM
    Moderator