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ć.

123 questions
6
votes
2 answers

Upload to Rails Shrine from NativeScript

I'm using Rails 5.2 with the Shrine gem for image upload. On the client side I'm using NativeScript 6.0 with Angular 8.0. I've installed Shrine and it's working on the Rails side and direct upload via Uppy. On the frontend (Android mobile) using…
map7
  • 4,722
  • 5
  • 55
  • 116
5
votes
1 answer

How do you seed images using Shrine

I can't seed my images using shrine, unlike carrierwave the below code doesn't work. Profile.create! id: 2, user_id: 2, brand: "The Revengers", location: "Azgaurd", phone_number:…
Ric-lavers
  • 63
  • 7
5
votes
1 answer

Shrine gem - how to delete uploaded images from s3

Apparently :remove_attachment plugin does the trick with checking and submitting but how can I call the method from the controller?
Hangai
  • 147
  • 12
4
votes
0 answers

Ruby/Rails - Shrine::Error (storage :cache isn't registered on PdfUploader)

I've been struggling to figure out why I'm receiving this error on Heroku. Shrine::Error (storage :cache isn't registered on PdfUploader) initializer.rb require "shrine" require "shrine/storage/s3" s3_options = { access_key_id: …
Adam Thede
  • 41
  • 2
3
votes
1 answer

How to upload while resizing the original image itself in Shrine

I use Shrine in a Ruby on Rails application to create the process of resizing and uploading images to storage. My current code is: image_uploader.rb require "image_processing/mini_magick" class ImageUploader < Shrine plugin :derivatives …
3
votes
1 answer

Move file on AWS S3 Bucket between folders using Shrine

Does Shrine support a way to copy/move files between folders inside a S3 Bucket? For instance, I upload a file into a folder called cache and if everything is OK, I then move that file into a store folder and clear the cache (immediately or using a…
jpac
  • 69
  • 5
3
votes
1 answer

Use Shrine to upload video files and generate thumbnails

I want to use the Shrine gem to upload video files, transcode, & generate thumbnails from the video. I am trying to convert Erik Dahlstrand's Shrine-Rails-example from photos to videos. I am having trouble creating the video uploader. I based this…
3
votes
1 answer

problem while trying to implement a drag and drop direct upload with shrine direct_upload for aws rails 5.2

Code: image_upload.js function uploadAttachment(attachment) { var file = attachment.file; var form = new FormData; form.append("Content-Type", file.type); form.append("forum_post_photo[image]", file); var xhr = new XMLHttpRequest; …
3
votes
3 answers

Using Multiple Rails ActiveStorage Services

I am using ActiveStorage for uploading PDFs and images. The PDFs need to be stored locally because of some privacy concerns, while the images need to be stored using Amazon S3. However, it looks like ActiveStorage only supports setting one service…
3
votes
2 answers

Upload images to different folders in s3 (by album names) using Shrine gem

I managed to upload files to s3 using shrine, but I'm trying to upload each photo to a different folder according to the album it belongs to. Lets say i have a bucket named: abc: Uploading images to the album: family should upload images to:…
Ziv Galili
  • 1,175
  • 12
  • 20
3
votes
0 answers

Direct uploads to S3 with fineuploader and Shrine

I am trying to use Shrine and fineuploader together to upload my files directly to S3. The issue I am facing is that the Shrine gem's presign_endpoint is a GET request that returns a json response formatted like this: { "url":…
Snake
  • 1,079
  • 10
  • 19
3
votes
3 answers

Inheriting from class Module

I am trying to understand the shrine gem source code that is a toolkit for file attachments. You can define an uploader on your model in rails like so: class Picture < ApplicationRecord include ImageUploader::Attachment.new(:image) end The…
trueinViso
  • 1,294
  • 2
  • 16
  • 30
3
votes
1 answer

Rails 5 + Shrine multiple files upload

I am trying to implement multiple files upload using polymorphic association and Shrine. class Campaign < ApplicationRecord has_many :photos, as: :imageable, dependent: :destroy accepts_nested_attributes_for :photos, allow_destroy:…
Anton
  • 500
  • 3
  • 13
3
votes
1 answer

Shrine with Rails multiple polymorphic image uploads

I've been struggling for about 5 hours trying to understand why Shrine is blocking my uploads. I either get errors like "Shrine: Invalid file", or "Expected Array but got string" in strong params. If there aren't errors, the images aren't actually…
Kevin Brown
  • 12,094
  • 32
  • 90
  • 149
2
votes
1 answer

Shrine clear cached images on persistence success

Background I am using file system storage, with the Shrine::Attachment module in a model setting (my_model), with activerecord (Rails). I am also using it in a direct upload scenario, therefore i need the response from the file upload (save to…
orion
  • 445
  • 1
  • 4
  • 15
1
2 3
8 9