View Source Dropkick (dropkick v0.0.0)

This module provides functions that you can use to interact directly with uploads and attachments.

Link to this section Summary

Functions

Caches an attachable by saving it on the provided directory under the "cache" prefix by default. When an attachable is cached we won't calculate any metadata information, the file is only saved to the directory. This function is usually usefull when you are doing async uploads - where you first save the file to a temporary location and only after some confirmation you actually move the file to its final destination. You probably want to clean this directory from time to time.

Calls the underlyning storage's copy function. Check the module Dropkick.Storage for documentation about the available options.

Calls the underlyning storage's delete function. Check the module Dropkick.Storage for documentation about the available options.

Moves an attachble from its current destination to another one. This function can be used to "promote" cached attachments without having to worry about cleaning up the temporary directory.

Calls the underlyning storage's put function. Check the module Dropkick.Storage for documentation about the available options.

Calls the underlyning storage's read function. Check the module Dropkick.Storage for documentation about the available options.

Stores an attachable by saving it on the provided directory under the "store" prefix by default. When an attachable is stored we'll calculate metadata information before moving the file to its destination.

Creates a version of the attachment with some transformation. Transformations validated against an attachment content_type. The current transformations supported are

Link to this section Functions

Link to this function

cache(attachable, opts \\ [])

View Source

Caches an attachable by saving it on the provided directory under the "cache" prefix by default. When an attachable is cached we won't calculate any metadata information, the file is only saved to the directory. This function is usually usefull when you are doing async uploads - where you first save the file to a temporary location and only after some confirmation you actually move the file to its final destination. You probably want to clean this directory from time to time.

Link to this function

copy(upload, dest, opts \\ [])

View Source

Calls the underlyning storage's copy function. Check the module Dropkick.Storage for documentation about the available options.

Link to this function

delete(upload, opts \\ [])

View Source

Calls the underlyning storage's delete function. Check the module Dropkick.Storage for documentation about the available options.

Moves an attachble from its current destination to another one. This function can be used to "promote" cached attachments without having to worry about cleaning up the temporary directory.

Calls the underlyning storage's put function. Check the module Dropkick.Storage for documentation about the available options.

Link to this function

read(upload, opts \\ [])

View Source

Calls the underlyning storage's read function. Check the module Dropkick.Storage for documentation about the available options.

Link to this function

store(upload, opts \\ [])

View Source

Stores an attachable by saving it on the provided directory under the "store" prefix by default. When an attachable is stored we'll calculate metadata information before moving the file to its destination.

Link to this function

transform(atch, transforms)

View Source

Creates a version of the attachment with some transformation. Transformations validated against an attachment content_type. The current transformations supported are:

image

image/*

Image transformations uses the image library behind the scenes

  • {:thumbnail, size, opts}: Generates an image thumbnail, receives the same options as Image.thumbnail/3