class ImageUploader < WhitehallUploader
  include CarrierWave::MiniMagick

  configure do |config|
    config.remove_previously_stored_files_after_update = false
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end

  version :s960 do
    process resize_to_fill: [960, 640]
  end
  version :s712, from_version: :s960 do
    process resize_to_fill: [712, 480]
  end
  version :s630, from_version: :s712 do
    process resize_to_fill: [630, 420]
  end
  version :s465, from_version: :s630 do
    process resize_to_fill: [465, 310]
  end
  version :s300, from_version: :s465 do
    process resize_to_fill: [300, 195]
  end
  version :s216, from_version: :s300 do
    process resize_to_fill: [216, 140]
  end
end

class ImageUploader < WhitehallUploader
  include CarrierWave::MiniMagick

  def extension_white_list
    %w(jpg jpeg gif png)
  end

  version :s960 do
    process resize_to_fill: [960, 640]
  end
  version :s712, from_version: :s960 do
    process resize_to_fill: [712, 480]
  end
  version :s630, from_version: :s712 do
    process resize_to_fill: [630, 420]
  end
  version :s465, from_version: :s630 do
    process resize_to_fill: [465, 310]
  end
  version :s300, from_version: :s465 do
    process resize_to_fill: [300, 195]
  end
  version :s216, from_version: :s300 do
    process resize_to_fill: [216, 140]
  end
end

--- 
+++ 
@@ -1,5 +1,9 @@
 class ImageUploader < WhitehallUploader
   include CarrierWave::MiniMagick
+
+  configure do |config|
+    config.remove_previously_stored_files_after_update = false
+  end
 
   def extension_white_list
     %w(jpg jpeg gif png)
Stop deleting updated Person image

Currently, when a `Person` has their image updated CarrierWave deletes
the previous image. This wasn't a problem when Whitehall rendered its
own content but now we are publishing content via Publishing API these
images will still be referenced from content in the content store.

As `people` are only being published as placeholders they don't trigger
dependency resolution and even when they do the deleted image will cause
requests for it to 404 and a placeholder to be used in production while
dependency resolution takes place.

This commit configures the `ImageUploader` to keep the previous versions
of files for the which will at least prevent them 404-ing if they are changed.

This functionality is not tested as I have been unable to write a
failing test. Previous 'versions' of files are not deleted when running
a test. This behaviour persists regardless of whether the test is run
with transactional or non-transactional fixtures and is possibly due to
the way virus scanning has been implemented.
