Questions tagged [shrine]

Shrine is a file upload toolkit for Ruby, it's designed to be simple, extensible, secure and fast, and provides an abstraction for different storages.

Shrine is a file upload toolkit for Ruby with the following characteristics:

  • It's composed entirely out of plugins, making it very extensible and flexible

  • It makes direct AJAX uploads to the application or S3 dead easy

  • It's designed from day one with backgrounding in mind (Sidekiq, Resque etc.), but it still retains seamless user experience

  • It provides a simple instance-level interface for file processing and validations

  • It comes with filesystem and S3 storage, but provides nice abstraction for other storages as well

It was created and is currently maintained primarily by Janko Marohnić.

141 questions
1
vote
1 answer

Customize Shrine gem JSON response

I'm using shrine gem in my rails app for for file uploading. I want to integrate this gem with fineuploader front-end library to enhance the user experience while uploading the files. I'm able to integrate it to an extent that I'm able to upload…
Faisal Khurshid
  • 1,869
  • 3
  • 21
  • 27
0
votes
1 answer

Is there a way to save the ETag value from Amazon S3 using the Shrine gem?

I am using the Shrine gem to upload files to Amazon S3. Is there any way to retrieve the ETag value for a file and save it to the database after it has been uploaded? Ideally I would like to access the ETag value in the upload response to avoid…
TenJack
  • 1,594
  • 4
  • 21
  • 35
0
votes
0 answers

Using shrine how can I convert all image uploads to jpegs?

Using the gem shrine (3.4.0) in RoR I have a hack to convert all image uploads to jpegs, but it uses a deprecated plugin that will be remove in Shrine 4. class ImageUploader < Shrine # Converts all images to jpegs process(:store) do |io,…
Justin Tanner
  • 14,062
  • 17
  • 82
  • 103
0
votes
0 answers

Shrine Direct S3 Upload results in octet-stream mime-type

After following this tutorial, we set up a Direct Upload using Shrine and Uppy on S3. During our tests, a pdf file is well uploaded on S3 in the cache folder via a Drag&Drop box on our app. The problem is that when we assign it to our Doc model, two…
Aurel
  • 21
  • 6
0
votes
1 answer

Edit item with picture in Rails admin 3.1.2 raise an error ' undefined method `url' '

I am doing my ruby upgrade from ruby 2.7.3 to 3.2.2. Beside many other issues I handled alone. I am getting this one with Rails_Admin and edit object with image attached. App is Rails 6.1.7 version and I am using shrine gem for image uploading…
Nezir
  • 6,727
  • 12
  • 54
  • 78
0
votes
0 answers

Uppy/Shrine: How to retrieve presigned url for video after successful upload (using AWS S3)

I'm using Uppy for file uploads in React, with a Rails API using Shrine. I'm trying to show a preview for an uploaded video before submitting a form. It's important to emphasize that this is specifically for a video upload, not an image. So the…
Doug
  • 1,517
  • 3
  • 18
  • 40
0
votes
0 answers

Shrine derivatives doesn't work when invoked from Rails console

I have a Publication object with a PDF field. When I update its thumbnail derivative from the model, like so before_save :generate_thumbnails def generate_thumbnails pdf_derivatives! end It works fine. But when I try to update a derivative from…
hardow2011
  • 39
  • 5
0
votes
0 answers

Rails Shrine Image uploader, can't remove attachment

I've tried adding the remove_attachment plugin, but nothing works. The attachment is still attached to the User. I've also tried just sending "null" and empty objects as the image, this does not work either. class ImageUploader < Shrine plugin…
Cinta
  • 453
  • 5
  • 22
0
votes
1 answer

Shrine upload_options for checksum_algorithm giving an error

I'm new to S3 and Shrine, and I'm working with a Shrine uploader in Ruby on Rails to upload files to Amazon S3, which has been in place for a couple of years on this Rails app. The thing I'm working on has a goal to have S3 generate a checksum when…
Mike Vallano
  • 326
  • 4
  • 4
0
votes
0 answers

Shrine - Download Endpoint with Account-based authentication

I'm using Shrine with Rails, with the download_endpoint plugin. I have this working with route-based authentication via Devise, but I'd like to go one step further and add account-based authentication so that users can only access their own…
Kobius
  • 674
  • 7
  • 28
0
votes
0 answers

Upload attachment asynchronously with Shrine

I want to upload big files (over 5GB). My API works as expected, but it's synchronous. Is there a way to upload attachments asynchronously with sidekiq? I created a worker, but since I cannot pass an object to perform_async method (I tried to pass…
0
votes
1 answer

How to resolve url for static asset in S3 with DefaultUrl plugin

i'm having trouble finding the correct way to generate a S3 URL for a public static asset through the default_url plugin in Shrine. The asset is the users avatar, which can be nil, so the idea was to use the plugin default_url to get the empty…
R. Sierra
  • 1,076
  • 6
  • 19
0
votes
1 answer

Ruby - How to set derivatives filename with Shrine from data_uri (base64)

Following from this question: Ruby - How to set data_uri (base64) filename with Shrine This works perfectly for my use case, however, the derivatives that are created all have the filename "image_processing_xxx". The URLs look great, but when you…
Kobius
  • 674
  • 7
  • 28
0
votes
1 answer

Shared derivatives configuration for multiple Shrine uploaders

I have uploaders for different types of images. Each has the same set of derivatives (large, medium, thumbnail), but different resolutions. But they also share some configuration. For example, each uploader converts the original to jpeg, changes…
Dan
  • 1,274
  • 2
  • 15
  • 32
0
votes
1 answer

True Paperclip Replacement (Speficially Structure of the File System)

With Rails 6, I need to replace Paperclip, but I can't find any substitutions that actually easily replicate it. Specifically, the file structure paperclip used: :model/:attachmant_field/000/000/000/:identifier/:style/:original_file_name Over the…