Discussions

Expand all | Collapse all

Embedded image not refreshing

  • 1.  Embedded image not refreshing

    Posted 27 days ago
    Hello!
    I am using an Apache webserver to host png images on our server and make these images available within Quick Base while on the local network only. I have a table called "Images," where each record is created for a specific png file on the server. The Image record contains a Formula-Rich Text field "Thumbnail," with the following formula:

    "<img src=\"http://[local IP Address]/subfolder/filename.png" height = \"500">"

    where [local IP Address] is the IP Address used on the local network to navigate to the machine running Apache.

    The Image record is then listed for a related "Device" in the Devices table, in the report "Embedded for Devices." This report includes the "Thumbnail" field, so when you look at a specific Device record, the Embedded report shows the thumbnails for all related images. 

    My problem is that when the image png file is updated/replaced on the server (with the same file name), the image displayed in Quick Base does not update, even if I reload the page. Even on the Image record itself, the Thumbnail does not update when you refresh the page.  

    Quick Base support has said that this is not supported natively, but can be done with a custom java script. I've done a fair bit of coding but no java script and no custom scripts for QB. Does anyone have a suggestion for where to start and how to implement this? I'm assuming it should be a fairly simple fix but I need some help getting started. 

    Thank you!

    ------------------------------
    Graeme
    ------------------------------


  • 2.  RE: Embedded image not refreshing

    Posted 27 days ago
    Edited by Mark Shnier (YQC) 27 days ago
    Try this.  It introduces a dummy parameter which will be different each minute to defeat the native Quick Base / browser caching.

    "<img src=\"http://[local IP Address]/subfolder/filename.png" height = \"500" &  "DummyDateTime=" & ToText(Now()) &  ">"



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Embedded image not refreshing

    Posted 24 days ago
    Edited by Graeme MATLAB 24 days ago
    Mark,
    Thanks for your quick reply and the suggestion. I was optimistic about this solution but have tried it as well as several others and wasn't able to find anything that would force QB to refresh the image linked in this html img tag. In case this is useful for others, here is what I tried, as well as the final workaround I decided on: 

    1. Original: I had a small typo (missing backslash) in my original post. The original, working, formula url was:
    "<img src=\"http://[local IP Address]/subfolder/filename.png" height = \"500\">"
    This shows the source file as an embedded image in QB. However, when the image source file changed, the image displayed in QB would NOT update, even when refreshing the page.

    2. Add a dummy text to the img tag as Mark suggested:
    "<img src=\"http://[local IP Address]/subfolder/filename.png" height = \"500\" & DummyDateTime= "& ToText(Now()) & ">"
    This had no effect; the image displayed in QB still does not update even if the source file is changed. I tried a few variations on this next.

    3. Add an "alt" tag to the img tag, where the alt text is the current time, so that it should be different every time the user looks at the page:
    "<img src=\"http://[local IP Address]/subfolder/filename.png" & "\"alt = \"" & ToText(Now()) & "\" height = \"500\">"
    No effect; image displayed in QB does not update if/when the source file is changed, even upon refreshing the page.

    4. Add some text to the field in addition to the image:
    "<img src=\"http://[local IP Address]/subfolder/filename.png" height = \"500\">"&<p>&ToText(Now())&"</p>"
    The text is displayed in QB below the embedded image, and the text updates each time you refresh the page. However, the image still doesn't update, even if the image source file has changed since the last time the page was loaded!

    5. Make the size of the image variable based on the time:
    var Number hgt = 500+Second(ToTimeOfDay(Now()));
    "<img src=\"http://[local IP Address]/subfolder/filename.png" height = \"" & ToText($hgt)&"\">"
    This worked to change the size of the image slightly each time you refreshed the page, but would not update the image itself, even if the source file had changed since the last refresh. 

    6. Each time the Image is overwritten on the server, check if the "Image" record showing this embedded image already exists in QB. If so, delete the record in QB and add a new record embedding the same filename, so that hopefully it should point to the latest source file. This also did not work - the embedded image remained the original file! 

    7. WORKAROUND: I am now including the current timestamp in the filename of the Image on the server. Each time the Image file is updated, this timestamp portion of the filename is changed, and the QB "Image" record is updated with a different filename to look for. A bit clunky, but this works, and achieves the result of getting the QB embedded image to update each time the file on the server has changed. 


    ------------------------------
    Graeme MATLAB
    ------------------------------



  • 4.  RE: Embedded image not refreshing

    Posted 24 days ago
    Wow, thx for posting.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------