I'm trying to work out a way to clear the cache of all manipulations of an image that have been created using Intervention/ImageCache's manipulation templates (and likely in the future the cache function as well).
I have a some manipulation templates that run a custom filters on the image:
'thumbnail' => function($image) {
return $image->filter(new ImageFilters\Fit(150));
},
The filter gets the focal point from the database and then runs the appropriate functions, using the focal point for the position as needed.
public function applyFilter(Image $image)
{
$fp = Media::where('file_name', $image->filename)->pluck('focal_point');
$fp = $fp ?: 'center';
return $image->fit($this->width, $this->height, function(){return true;}, $fp);
}
This all works fine, but when the focal point is changed by the user the image isn't updated because of the cache. I need a way of clearing the cache for that specific image across the board.
From what I can tell each manipulated image is given its own unique cache key made up of an md5 hash, but I can't find any way of targeting all manipulations of a single image.