Sha256: dcbc00bcae5d50fd7b97f45876d71e97ffc53f3adb9d26b93002590a4450e968

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 Bytes

Contents

module Spotlight
  ##
  # Exhibit contact profile pictures
  class AvatarUploader < CarrierWave::Uploader::Base
    include CarrierWave::MiniMagick

    storage Spotlight::Engine.config.uploader_storage

    version :thumb do
      process crop: :avatar ## Crops this version based on original image
      resize_to_limit(70, 70)
    end

    # Override the directory where uploaded files will be stored.
    # This is a sensible default for uploaders that are meant to be mounted:
    def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end

    def default_url
      ActionController::Base.helpers.asset_path('fallback/' + [version_name, 'default.png'].compact.join('_'))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-spotlight-0.25.0 app/uploaders/spotlight/avatar_uploader.rb
blacklight-spotlight-0.24.0 app/uploaders/spotlight/avatar_uploader.rb
blacklight-spotlight-0.23.0 app/uploaders/spotlight/avatar_uploader.rb
blacklight-spotlight-0.22.0 app/uploaders/spotlight/avatar_uploader.rb
blacklight-spotlight-0.21.0 app/uploaders/spotlight/avatar_uploader.rb