[CLOSED] Force load of an image

  1. #1

    [CLOSED] Force load of an image

    Hi, I hope you can help me.

    I have this in my web page:
                                <ext:Panel runat="server" Width="410" Border="false" Layout="VBoxLayout">
                                        <ext:Image ID="iCa" runat="server" Width="380" Height="280" />
                                        <ext:Image ID="iCr" runat="server" Width="380" Height="280"/>
    So, in codebehind I assign the imageUrl property:
                            iCa.ImageUrl = somvalue + ".jpg";
    My question is, how can I force to load the image each time I call my webpage?.

    I have this situation I load the webpage the first time, and it shows the current image on the disk, but in some cases I need to change the image(keeping the same filename), so in this cases it is when I need to force an image load of the right file(physical not the one in the cache).

    Last edited by Daniil; Jan 30, 2015 at 2:58 PM. Reason: [CLOSED]
  2. #2

    Possible solution

    I put this in the code and it's working:

    iCr.ImageUrl = somevalue + "jpg?t=" + Dates.TimeStamp();
    Dates.TimeStamp is a function for generate the seconds from the actual date.

    Any other solution is welcomed.
  3. #3
    Hi @rguardado,

    It is called a cache buster that you used and it is probably the only solution in your scenario.

    A new value of parameter in the URL's query string "tells" a browser to re-request the image instead of loading it from cache. A cache buster parameter's value is supposed to be unique. If your Dates.TimeStamp() returns the amount of seconds starting from some specific date, then it should be always unique unless a few page requests happen within one second.

    It is another possible cache buster:

Similar Threads

  1. [CLOSED] Load byte array jpg into a Ext:Image
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 02, 2018, 5:19 PM
  2. how to load image dynamically?
    By hongxue in forum 2.x Help
    Replies: 0
    Last Post: Sep 08, 2013, 7:45 AM
  3. [CLOSED] Load html in window to print an image.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 03, 2011, 10:37 AM
  4. Add load event to Ext.net.Image
    By jchau in forum Feature Requests
    Replies: 7
    Last Post: Jul 23, 2010, 2:24 PM
  5. Replies: 3
    Last Post: Nov 06, 2009, 10:46 AM

Tags for this Thread

Posting Permissions