File Attachment toolkit for Crystal applications. Heavily inspired by Shrine for Ruby.
Updated S3 upload mechanics.
Updated dependencies. Fixed supported Crystal versions.
The StoreDimensions
plugin extracts dimensions of uploaded images and stores them into the metadata.
class Uploader < Shrine
load_plugin(Shrine::Plugins::StoreDimensions,
analyzer: Shrine::Plugins::StoreDimensions::Tools::BuiltIn)
finalize_plugins!
end
image.metadata["width"]
image.metadata["height"]
Removed JSON.mapping
in favor of JSON::Serializable
.
Thanks to @wout.
Added support for S3 Storage.
Shrine.cr got plugin system! Hooray!
Two plugins (DetermineMimeType
and AddMetadata
) are are included into this shard, you can read more about them in Readme.
Also I refactored Shrine::UploadedFile::Metadata
into Shrine::UploadedFile::MetadataType
which is now a Hash
. NamedTuple
are also replaced with Hash
in Shrine
and Shrine::UploadedFile
classes.