locked
Blob image problem

    Question

  • I'm too tired with blob in winjs, someone help please ...

    Open FolderPicker and select a folder with some image inside.

          Get width, height of image picked and create blob to display it <= My problem is here

                Save height, width and blob string to a local json file.

                Create a div like a bookmark with folder name in default.html

    After close app and open it again -> click on bookmark -> load json file -> display image with width height saved.

    The image not show after i close app, need to open FolderPicker again and select picture again.

    Friday, November 7, 2014 8:53 AM

Answers

  • Hi nhattuanbl,

    There could be another easier solution instead of create blob to display it, we can save the file in StorageItemMostRecentlyUsedList class and use it once we re-open the app. See this for more information: How to track recently used files and folders, I think its much easier for you to display the image since you can re-use your current code instead of create blob.

    However to answer your question, I don't know how you create the blob, but I always use this code to create blob via image stream.

    var blob = MSApp.createBlobFromRandomAccessStream("image/bmp", stream);
    

    After you have the blob data, convert it to json should not be any problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 10, 2014 5:23 AM
    Moderator

All replies

  • Hi nhattuanbl,

    There could be another easier solution instead of create blob to display it, we can save the file in StorageItemMostRecentlyUsedList class and use it once we re-open the app. See this for more information: How to track recently used files and folders, I think its much easier for you to display the image since you can re-use your current code instead of create blob.

    However to answer your question, I don't know how you create the blob, but I always use this code to create blob via image stream.

    var blob = MSApp.createBlobFromRandomAccessStream("image/bmp", stream);
    

    After you have the blob data, convert it to json should not be any problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 10, 2014 5:23 AM
    Moderator
  • Thank for your help, i'm trying...
    Monday, November 10, 2014 11:51 AM