Skip to main content

Shrine 2.10.0

New features

  • The :mini_magick analyzer has been added to the store_dimensions plugin, which uses the MiniMagick gem to extract image dimensions.

  • The :ruby_vips analyzer has been added to the store_dimensions plugin, which uses the ruby-vips gem to extract image dimensions.

  • The :fastimage analyzer has been added to the determine_mime_type plugin, which uses the FastImage gem to determine the MIME type of the file.

  • Shrine::UploadedFile#download now accepts a block for downloading an uploaded file temporarily. This is useful when wanting to validate whether an uploaded image is valid or corrupted, or when generating thumbnails.

uploaded_file.download do |tempfile|
  # ...
end # tempfile is deleted

Other improvements

  • It's not required that IO objects respond to #size anymore. This is useful when uploading streams of data where the size is not known.

  • The S3 storage now supports IO objects with unknown size. Under the hood it will use multipart upload.

  • The logger is now properly inherited and shared between Shrine subclasses.

  • The attachment URL generated by download_endpoint now stays the same regardless of the order of elements in the metadata hash. Previously it could change after the uploaded file data is loaded from the database, because the order of the metadata hash elements would change, which is not desirable for caching.

Backwards compatibility

  • The :rack_mime extension inferrer has been removed from the infer_extension plugin, due to not having acceptable behaviour. The new default extension inferrer is :mime_types.

  • The :heroku formatter in the logging plugin has been soft-renamed to :logfmt. The :heroku alias will stop being supported in Shrine 3.

  • The Shrine::IO_METHODS constant has been depreacted, and will become private in Shrine 3.