amtgard / ORK3

Version 3 of the Online Record Keeper
Other
23 stars 11 forks source link

Suggest a refresh after uploading images #233

Closed jkat718 closed 3 years ago

jkat718 commented 4 years ago

Since uploaded images take a while to appear, due to old images lingering in the cache, we could add a message to the effect of "Image uploaded! If new image does not appear, try refreshing the page." when uploading images may help people realize this.

Example: Annotation 2019-08-28 094913

p0lar-bear commented 4 years ago

Alternatively, I think a more graceful solution may be to append a random string of numbers to the image's URI's query string after an image is uploaded, and only when that happens. I use this technique in my own development projects to make sure that the browser is loading a fresh script.

E.g. a user uploads an image that gets saved to images/heraldry/player1234.png. If the upload is successful, the page generated by the server should set the updated image's src attribute to something like images/heraldry/player1234.png?<random number>. On subsequent page loads, the query string is not present in the image's src.

This will ensure that the updated image is loaded and subsequently cached.

kenwalker commented 4 years ago

This is what I do on the player page in mORK. Since I allow uploads of photos, I make sure the page is displaying the correct one.

Glenalth commented 4 years ago

The random string would work better, a normal refresh doesn't work most of the time.

jrtaylor-com commented 3 years ago

PR is ready to go, added string to normal and admin view