View Source Dropkick.Attachableer behaviour (dropkick v0.0.0)

This modules provides a definition to specialized uploaders that can be used to specify custom upload workflows. A specialized uploader acts as a hook before calling the function at Dropkick and allow you to modify how the upload is handled.

Link to this section Summary

Callbacks

See Dropkick.cache/2 for more information.

Provide a default URL if no upload was found

Overrides the filename used when the attachment is stored. The original filename will still be kept as a metadata.

See Dropkick.move/2 for more information.

Defines the default prefix that will be used to store and retrieve uploads.

See Dropkick.store/2 for more information.

Defines the transformations to be applied after saving attachments.

Defines a series of validations that will be called before caching the attachment.

Link to this section Types

@type option() :: {atom(), any()}
@type transforms() ::
  :noaction
  | {:blur, list()}
  | {:resize, float(), list()}
  | {:thumbnail, pos_integer() | String.t(), list()}

Link to this section Callbacks

@callback cache(upload :: Dropkick.Upload.t(), list()) :: Dropkick.Attachment.type()

See Dropkick.cache/2 for more information.

@callback default_url(context :: map()) :: String.t()

Provide a default URL if no upload was found

@callback filename(Dropkick.Attachment.type(), context :: map()) :: String.t()

Overrides the filename used when the attachment is stored. The original filename will still be kept as a metadata.

@callback move(atch :: Dropkick.Attachment.t()) :: Dropkick.Attachment.type()

See Dropkick.move/2 for more information.

Link to this callback

storage_prefix(type, context)

View Source
@callback storage_prefix(Dropkick.Attachment.type(), context :: map()) :: String.t()

Defines the default prefix that will be used to store and retrieve uploads.

@callback store(upload :: Dropkick.Upload.t(), list()) :: Dropkick.Attachment.type()

See Dropkick.store/2 for more information.

Link to this callback

transforms(type, context)

View Source
@callback transforms(Dropkick.Attachment.type(), context :: map()) :: transforms()

Defines the transformations to be applied after saving attachments.

@callback validate(Dropkick.Attachment.type(), context :: map()) ::
  :ok | {:error, String.t()}

Defines a series of validations that will be called before caching the attachment.

Link to this section Functions