Storage.Variant (PhoenixContribStorage v0.1.0)
View SourceHandles image transformations and variants.
Variants allow you to create different versions of images on-demand, similar to Rails ActiveStorage variants.
Examples
# Create a thumbnail variant
thumbnail = Storage.Variant.processed(blob, resize: "100x100")
# Create multiple variants
variants = %{
thumb: [resize: "100x100"],
medium: [resize: "300x300"],
large: [resize: "800x600"]
}
processed_variants = Storage.Variant.process_variants(blob, variants)
Summary
Functions
Checks if a variant exists in storage.
Creates a new variant with the given transformations.
Processes multiple variants of a blob.
Processes a variant and returns the processed blob.
Gets the URL for a variant, processing it if necessary.
Generates a variant key for caching.
Types
Functions
Checks if a variant exists in storage.
Creates a new variant with the given transformations.
Processes multiple variants of a blob.
Processes a variant and returns the processed blob.
Gets the URL for a variant, processing it if necessary.
Generates a variant key for caching.