Forum Discussion

LaszloM's avatar
LaszloM
Qrew Trainee
3 years ago

Thumbnail pictures refreshing slowly

My thumbnail pictures created with this:

If(Length([Attachment File])=0,"","<img width=\"30\" src=\""&URLRoot()&"up/"&Dbid()&"/a/r"&[Attachment ID#]&"/e7/v0\"/>")

refresh unbearably slowly. When I create a new record or create the first [Attachment File] in the record, there is no problem. Contrary to that if i edit a record already having an Attached file and i change the file to another, it takes more than minutes for the thumbnail image to refresh.
Especially on a mobile device i need the thumbnails for the user to review the pictures taken in a report, so if an attachment file is changed, the report shall follow. But it - practically - doesn't.
In my tests so far there are not more than 6 or 8 recoerd with thumbnails in a report, so i am not querying hundreds of them...

Can I do anything to make the thumbnail refresh faster after edits? Am I creating the thumbnail picture the good way? Interested in any workaround if all else fails!

Thank You!

------------------------------
Laszlo M
------------------------------
  • MarkShnier__You's avatar
    MarkShnier__You
    3 years ago
    OK, try this and see if it eliminates the caching issue. I was able to test this and change the file attachment and the "old" way stayed cached, but the new way immediately used the new image.

    "<img src=" & URLRoot() & "up/" & Dbid()
    & "/g/r" & QB32Encode([Record ID#])
    & "/e" & QB32Encode(12) // 12 is the fid of the file attachment field
    & "/va/" & URLEncode([Picture]) // my file field is called [picture]
    & " width=30>"

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
  • The issue is with browser caching and not quickbase.
    The url that the formula generates is always the same per record, it is quickbase that dynamically serves up the latest version of the image at that url because it uses "v0"
    However the browser seeing the same url will load the image from the cache without even asking quickbase for the new image.

    You can test this on your end by reloading the record with a hard refresh by pressing ctrl-f5

    ------------------------------
    Simon H
    ------------------------------
    • SimonH's avatar
      SimonH
      Qrew Cadet
      I did some more poking around.
      It seems like cache control is setting the cache time tp 2 minutes, so your assessment of "longer then a minute" is spot on. 
      A solution you can implement on your end is something to referred to as "cache busting"
      This is where you append a useless query parameter to the end of the URL so that the browser then sees is as a new url and requests the image anew without loading from the cache.
      I experimented with a formula that appends the last modified time to the url, however a simple update of the image does not actually set the last modified time so unless your users are also changing something else it won't work.


      ------------------------------
      Simon H
      ------------------------------
      • LaszloM's avatar
        LaszloM
        Qrew Trainee
        Thank You Simon H for the interesting answers!

        On the desktop - I tried - hard refresh helps. Still it is a question for me how to initiate it from QB... if this is possible at all...
        But what can I do for my mobile users using the QB app on their devices? I have a form on my tablet before me with a thumbnail not refreshed for an hour or so...
        I feel on mobile - have to forget edited files' thumbnails.

        ------------------------------
        Laszlo M
        ------------------------------