```ruby
# encoding: utf-8

class ImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  include CarrierWave::MimeTypes
  include Sprockets::Helpers::RailsHelper
  include Sprockets::Helpers::IsolatedHelper

  EXTENSION_WHITE_LIST = %w(jpg jpeg gif png)

  process :set_content_type

  version :thumb do
    resize_to_fill(200, 200, 'North')
  end

  def store_dir
    model.store_dir || calculate_store_dir
  end

  def default_url
    image_path('placeholder.png')
  end

  def extension_white_list
    EXTENSION_WHITE_LIST
  end

  def md5
    model.md5 || calculate_md5
  end

  def cached_master
    @cached_master ||= CarrierWave::SanitizedFile.new(
      tempfile: StringIO.new(file.read),
      filename: File.basename(path),
      content_type: file.content_type
    )
  end

  private
  def calculate_store_dir
    File.join(*['uploads', 'images',
                model.album.slug, model.source.name, model.id].compact)
  end

  def calculate_md5
    Digest::MD5.hexdigest(model.image.read)
  end
end
```

Make sure it doesn't bomb out if no source.
user
```ruby
# encoding: utf-8

class ImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  include CarrierWave::MimeTypes
  include Sprockets::Helpers::RailsHelper
  include Sprockets::Helpers::IsolatedHelper

  EXTENSION_WHITE_LIST = %w(jpg jpeg gif png)

  process :set_content_type

  version :thumb do
    resize_to_fill(200, 200, 'North')
  end

  def store_dir
    model.store_dir || calculate_store_dir
  end

  def default_url
    image_path('placeholder.png')
  end

  def extension_white_list
    EXTENSION_WHITE_LIST
  end

  def md5
    model.md5 || calculate_md5
  end

  def cached_master
    @cached_master ||= CarrierWave::SanitizedFile.new(
      tempfile: StringIO.new(file.read),
      filename: File.basename(path),
      content_type: file.content_type
    )
  end

  private
  def calculate_store_dir
    File.join(*['uploads', 'images',
                model.album.slug, model.source.try(:name), model.id].compact)
  end

  def calculate_md5
    Digest::MD5.hexdigest(model.image.read)
  end
end
```
assistant