Sha256: 151a71694d6371a0af937bafaa8a4356246cd1522375bea655492fcb874352a5
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
# Uploaders Uploaders are built on top of Carrierwave and should extend `Archangel::ApplicationUploader`. Below is a basic example of an Uploader ``` # frozen_string_literal: true module Archangel class AmazingUploader < ApplicationUploader 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 def default_path "archangel/fallback/" + [version_name, "amazing.png"].compact.join("_") end def filename "amazing.#{file.extension}" if original_filename.present? end end end ``` ## Default Image Path When no file has been uploaded, fallback images for Carrierwave will need to be provided as well as default path to the fallback images. Assuming `original`, `large`, `medium`, `small` and `tiny` as the sizes specified, the following images will need to be created; * `archangel/fallback/amazing.jpg` * `archangel/fallback/large_amazing.jpg` * `archangel/fallback/medium_amazing.jpg` * `archangel/fallback/small_amazing.jpg` * `archangel/fallback/tiny_amazing.jpg` These images will need to be added to the `app/assets/images/` directory. To change this path where fallback images life, override the `default_path` method. ## Upload Path When `AmazingUploader` is used in the Page controller, `uploads/archangel/pages/amazing/123` will become the path for uploaded files. To change this path, override the `store_dir` method.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
archangel-0.4.0 | docs/Extension/Uploaders.md |