X3 Photo Gallery Support Forums
Yes. Keep in mind, "for a while" could be a long time period, unless you empty your browser cache.ed_f wrote:does that mean that the image is actually exchanged and I just see (for while) the older version?
Yes. Unless you are also using some CDN cache like Cloudflare (which I doubt you are).ed_f wrote: for anybody looking for the first time the image IS the new one?
Basically yes. Just to clarify, X3 will know immediately when it's gone, so it wouldn't display in the gallery or anything. However, if you make a direct request in browser to the image url, it could still display after it's deleted, if your browser has it cached.ed_f wrote: when I delete it once it will be gone and only just appears to still be there?
Would be unusual, unless you are unknowingly using some CDN service through your hosting, and I can't say from here without diagnosing. Besides, it doesn't really matter if it's browser or network, because this is the issues you will deal with when replacing images without updating the name.ed_f wrote: edit: hours later the changes (without another cache-delete!) appear. my hoster, probably?
The Etag is kinda useless. Client must contact origin server first "hey, do you have an update for this image"? Server replies "yup I do", client must then load entire image ... This is even slower than simply loading the image without communicating with server first. In case the browsers cache is valid, it might be a tiny bit faster, but the client still needs to make a request to origin server just to check if the current cached image is still valid. This is not very fast, and perhaps not much faster than just loading the image (which is normally quite fast these days). So this caching method is simply inferior to using Expires and Cache-Control headers for static assets like images. Etag might be more useful for example for documents (html), depending on the website and scenario where the strategy is worthwhile.metallissimus wrote:I was wondering if there is a way to let the client know that a cached item is no longer up to date and I stumbled upon the ETag. With my not so deep understanding of web technology this seems to be a possible solution for the issue. Am I missing something?
I find it quite fascinating that such an ugly method seems to be the best solution (this is not meant as criticism towards you, rather at "the internet" – whoever that might be). This might be technically straight forward, but I think renaming something that is basically the same (the same image updated, e.g. resized or with better compression etc.) doesn't make any sense at all from a user perspective.And in conclusion, you must rename files to avoid caching.
True that, but it is what it is. And since "performance" is such an important internet feature, the likes of cache has been implemented aggressively. It's not useful to rename a "page" mypage.html or /subdir/, and that's why html pages are never cached, to make sure latest page is always displayed. Most images on the other hand, will never change, and can be cached effectively. Even when an image changes, it is mostly embedded on a page, and the image name can be modified in the document source without the user even knowing (or caring).metallissimus wrote: Thanks for the explanation.
I find it quite fascinating that such an ugly method seems to be the best solution (this is not meant as criticism towards you, rather at "the internet" – whoever that might be). This might be technically straight forward, but I think renaming something that is basically the same (the same image updated, e.g. resized or with better compression etc.) doesn't make any sense at all from a user perspective.And in conclusion, you must rename files to avoid caching.
As I mention this, we could perhaps add some mechanism in X3 also. For example <img src="image.jpg?IMAGE-MODIFIED-DATE" ... By appending the date, it would bypass cache if the ?date changes, but will still get cached when the date remains the same. Keep in mind, this would work correctly when viewing images inside X3 website, but you would still get old cache results if trying to access /path/to/image.jpg directly in browser without any ?parameter.mjau-mjau wrote:Even when an image changes, it is mostly embedded on a page, and the image name can be modified in the document source without the user even knowing (or caring).
:heavy_check_mark:Yesed_f wrote: that sounds like a solution! give it a try, karl!