Sha256: e37e83fffc10147399c9d753e9739fbded621870c3a9cf3b14d569b81d072397

Contents?: true

Size: 873 Bytes

Versions: 9

Compression:

Stored size: 873 Bytes

Contents

# frozen_string_literal: true

module Archangel
  ##
  # Avatar uploader
  #
  class AvatarUploader < ApplicationUploader
    process resize_to_fit: [512, 512]

    version :large do
      process resize_to_fit: [256, 256]
    end

    version :medium, from_version: :large do
      process resize_to_fit: [128, 128]
    end

    version :small, from_version: :medium do
      process resize_to_fit: [64, 64]
    end

    version :tiny, from_version: :small do
      process resize_to_fit: [32, 32]
    end

    ##
    # Uploaded path for file
    #
    # @return [String] upload path
    #
    def default_path
      "archangel/fallback/" + [version_name, "avatar.png"].compact.join("_")
    end

    ##
    # Uploaded file name
    #
    # @return [String] file name
    #
    def filename
      "avatar.#{file.extension}" if original_filename.present?
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
archangel-0.4.0 app/uploaders/archangel/avatar_uploader.rb
archangel-0.3.0 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.8 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.7 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.6 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.5 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.4 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.3 app/uploaders/archangel/avatar_uploader.rb
archangel-0.0.2 app/uploaders/archangel/avatar_uploader.rb