0

advise for store pictures

Hello all,
I am currently developing an application which displays high resolution pictures as part of a slideshow-based user experience.
Pictures are loaded from a remote web server through internet.
Given the size of the pictures, I am looking for a way to store the pictures in the widget local memory or HDD. End-users will then be able to delete their pictures as needed.
Can you please advise the best way to at best store content in the widget memory, at least cache them in the internal memory to optimize the user experience?

Thanks for your help.

by
  • fo
  • Nov 25, 2009
13 Replies
  • QUOTE (shiyi @ Nov 25 2009, 02:27 PM) <{POST_SNAPBACK}>
    Hello all,
    I am currently developing an application which displays high resolution pictures as part of a slideshow-based user experience.
    Pictures are loaded from a remote web server through internet.
    Given the size of the pictures, I am looking for a way to store the pictures in the widget local memory or HDD. End-users will then be able to delete their pictures as needed.
    Can you please advise the best way to at best store content in the widget memory, at least cache them in the internal memory to optimize the user experience?

    Thanks for your help.


    Hi shivi,

    I think that we have not right to save the pictures in the widget memory or cache on tv. :)
    0
  • QUOTE (tatquanghoa @ Nov 25 2009, 07:27 PM) <{POST_SNAPBACK}>
    Hi shivi,

    I think that we have not right to save the pictures in the widget memory or cache on tv. :)Thanks
    0
  • QUOTE (shiyi @ Nov 26 2009, 02:36 AM) <{POST_SNAPBACK}>
    Thank you for your prompt reply.
    Since we can not save pictures in the widget memory or cache, I have another question.

    Now, I display some images in a Grid in a FullscreenView. When the view is called, it displays the photos with given URLs (pointing to the server where the photos are stored). So the widget needs to download the picture(s) everytime the given URL is called. The user experience is not optimized because of the download time needed to display each picture.
    When I turn to others Views and turn back to that view, it seems that it is actually reloading those same photos. And it really takes time.
    So, I would like to know if there is a way to, at least, cache views already created or temporary store those photos during the execution of the widget. So that, when I reuse them, it should be much quicker.

    Please advise.
    Thanks


    Hi shiyi,

    That is belong on your method. You can call to server once time and contain those pictures in the object.

    Thanks and Regards,
    Hoa Tat.
    0
  • QUOTE (tatquanghoa @ Nov 26 2009, 07:40 PM) <{POST_SNAPBACK}>
    Hi shiyi,

    That is belong on your method. You can call to server once time and contain those pictures in the object.

    Thanks and Regards,
    Hoa Tat.


    Thanks for your prompt reply.
    This is precisely what i'm trying to achieve: make only a single call to the server and put the related pictures in the object.
    Would you have a sample code you could share?

    Many thanks in advance.
    0
  • Anyone can help me?

    Many thanks in advance.
    0
  • Something like this
    CODE
    var my_images = {};   //Main object to hold "Images"

    //Do whatever you are doing to grab the image locations
    //Please note this is only a way to cache and store images

    //First Call
    var display_image = new KONtx.element.Image({src: 'src_url'});
    this.controls.display_img = display_image;
    my_images['image_id'] = this.controsl.display_img;
    my_images['image_id'].appendTo(this);

    //Calling the image for re-display
    this.controsl.display_img = my_images['image_id'];

    /*
    Important Considerations
    - There is limited Memory in the devices and it would make sense to only cache a small number of files.
    - The resolution does not get any better than 540 or 1080
    - Is there a reason to not preform a server side image reduction before sourcing the file?
    - You can also use the Async LoadingSrc to display a loading image while the file comes down.
    */
    0
  • QUOTE (WidgetRealm @ Nov 30 2009, 11:03 AM) <{POST_SNAPBACK}>
    Something like this
    CODE
    var my_images = {};   //Main object to hold "Images"

    //Do whatever you are doing to grab the image locations
    //Please note this is only a way to cache and store images

    //First Call
    var display_image = new KONtx.element.Image({src: 'src_url'});
    this.controls.display_img = display_image;
    my_images['image_id'] = this.controsl.display_img;
    my_images['image_id'].appendTo(this);

    //Calling the image for re-display
    this.controsl.display_img = my_images['image_id'];

    /*
    Important Considerations
    - There is limited Memory in the devices and it would make sense to only cache a small number of files.
    - The resolution does not get any better than 540 or 1080
    - Is there a reason to not preform a server side image reduction before sourcing the file?
    - You can also use the Async LoadingSrc to display a loading image while the file comes down.
    */


    Thanks very much for your prompt reply.
    I have followed your instructions, and it works. I can indeed store images in an array and use them.

    However I am now facing another issue.
    I can get the first image. But there is no second image. And there is no errors in the console. Can this issue be caused by an improper use of the function "appendTo(this)" ?
    I might have not appended the image into "this" correctly. I have tried to use the method "this.getView()" like the following code shows, but it doesn't work (it says that "this.getView is not a function").

    You will find below my code example:

    CODE
    var my_images = {}; //set as global so that I can use wherever

    //operations to store images

    //I want to display 2 images in a view. The first appears directly, and the second appears after 4 seconds.

    createView: function() {
    my_images[0].element.width = 480;
    my_images[0].element.height = 360;
    my_images[0].element.vOffset = 90;
    my_images[0].appendTo(this);

    var myTimer = KONtx.utility.timer.setTimeout(
    function(){
    //var self = this.getView();
    my_images[1].element.width = 480;
    my_images[1].element.height = 360;
    my_images[1].element.vOffset = 90;
    my_images[1].element.hOffset = 480;
    my_images[1].appendTo(this); //appendTo(self);
    },
    4000 );

    }


    Please advise.
    Many thanks in advance.
    0
  • I get what you are trying to do.

    The issue is that you need to be updating the View.

    So something like this may get you going in the right direction:
    CODE
    var Gallery = new KONtx.Class({
    ClassName: 'Gallery',

    Extends: KONtx.system.FullscreenView,

    my_images: {}, //set as global so that I can use wherever
    current_image: 0,
    image_timer: new Timer(),

    createView: function() {
    //Place first Image
    my_images[this.current_image].element.width = 480;
    my_images[this.current_image].element.height = 360;
    my_images[this.current_image].element.vOffset = 90;
    my_images[this.current_image].appendTo(this);

    //Set Timer Values
    this.image_timer.onTimerFired = this.nex_image.bindTo(this);
    this.image_timer.interval = 4;
    this.image_timer.ticking = true;
    },

    updateView: function() {
    this.image_timer.ticking = true;
    my_images[this.current_image].element.width = 480;
    my_images[this.current_image].element.height = 360;
    my_images[this.current_image].element.vOffset = 90;
    my_images[this.current_image].appendTo(this);
    },

    nex_image: function() {
    this.current_image++;
    //You will need to put in check here to make sure to wrap around the image gallery
    this.updateView();
    }
    });


    Important Considerations
    - Make sure to kill the Timer when you exit the view (this.image_timer.ticking = false;)
    - 4 seconds is short period and will likely result in rejection of the widget as it will lead to poor widget performance

    Side note:
    The only way to change what is displayed on the screen is to force the platform to update the View by using updateView() in your view code.
    0
  • Thanks very much for your directions. The issue is now fixed. I can now store the images in an array as objects. When the images are loaded, they are stored into the widget and I can use them without having to download them again.

    However, after several tests, we identified two new issues:
    1- I found out that as long as I use the first nine or ten images, it works well. When it turns to the eleventh image or after, it will download the image again;
    2- if I do not use the images for one minute or more, images are downloaded again when I need to use them. It seems that they are just temporarily cached in the widget memory.
    I don't know if there is a limitation for caching downloaded content, or if it's just because the WDk does not support it.

    Please advise.
    Many thanks in advance.
    0
  • QUOTE (shiyi @ Dec 3 2009, 05:41 AM) <{POST_SNAPBACK}>
    1- I found out that as long as I use the first nine or ten images, it works well. When it turns to the eleventh image or after, it will download the image again;
    2- if I do not use the images for one minute or more, images are downloaded again when I need to use them. It seems that they are just temporarily cached in the widget memory.
    I don't know if there is a limitation for caching downloaded content, or if it's just because the WDk does not support it.


    Any update on this in the new year :PThanks, Nikola
    0
  • QUOTE (georgi.dinchev @ Jan 4 2010, 08:30 AM) <{POST_SNAPBACK}>
    I have 20 images and they are OK when they are all displayed on the screen. When I hide some of them the problem comes - they are downloaded again when I show them. I tried to change opacity to 0 or to set negative vertical offset (-1000) with no effect.


    Any update on this? Is it possible to stop image expiration, so when I download them once, they remain in memory?
    0
  • Hi Shiyi,

    Were you able to resolve your issues? I am facing the same problem.

    Please can anyone answer this - is there a limitation on size for caching downloaded content?

    I have a slideshow of 6 images. The first time caching takes places but once it wraps around to showing the first image again....the image is downloaded.

    Thanks
    0
  • This probably is caused by the garbage collection and internal memory management. Considering the limited resource you will get on TV, this might not be the bad idea. However, if you still insist to storing those image in memory for a long time, try "this.persist" to see what will happen!
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets