Fix formatted image file name assumptions

* The regex used to match filenames in `Image::deleteFormattedImages`
  required digits in the filename. These digits were present when using
  the `Image::generate*` methods, but are not guaranteed to be present
  when using custom resize methods (added by extension). This meant that
  the resampled images generated by custom getFormattedImage methods were
  not guaranteed to be deleted when `Image::deleteFormattedImages` was
  called.

* `Image::cacheFilename` did not sanitise arguments before generating a
  filename. This meant it was possible to generate invalid filenames
  (for example, containing a slash).