Hi all. I've got a site built from SS 2.4.5 here.
I'm looking into separating the CMS and Frontend to different servers and syncing assets uploaded via the CMS "Files and Images" section with the Frontend. But since the CMS server will never have resampled images, I must exclude _resampled directories from the sync process. Else all _resampled directories in the Frontend will be purged every time the sync runs (because the CMS folders are empty).
So what happens when a new image is uploaded is that the original image is synced to the frontend assets/ directory. And nothing is touched in the relevant _resampled directory. This is fine for new images. But causes problems for images that are removed and replaced with an image of the same name. Obviously the previous resampled image persists.
What I want to do is pretty simple and can be thought of in the context of any other Silverstripe site - When I call SetWidth(), which in turn calls getFormattedImage(), I would like the latter to check the maketime of both the original and cached images. If the original is newer than the cached copy, resample from scratch.
What I don't want to do is hack the core. Can anyone think of a good way to decorate Image to alter the behavior of getFormattedImage()?
Posted to: Extend/Decorate getFormattedImage (Image class) | Show Thread | Post Reply