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
7
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
  • 307
  • 2
  • 14
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
  • 5,096
  • 6
  • 65
  • 128
6
votes
2 answers

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
  • 73
  • 7
4
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…
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

Vips - add text on top of image, after resize in Ruby

I'm using Vips to resize images via Shrine, hoping it's possible to use the Vips library to merge a layer of text on top of the image. ImageProcessing::Vips.source(image).resize_to_fill!(width, height) This code works great, how can I add a layer…
Kobius
  • 674
  • 7
  • 28
3
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
  • 504
  • 1
  • 5
  • 17
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

Extracting image dimensions in the background with Shrine

I have set up direct uploads to S3 with Shrine. This works great. Among others, I have the following plugins enabled: Shrine.plugin :backgrounding Shrine.plugin :store_dimensions Shrine.plugin :restore_cached_data Correct me if I'm wrong but image…
Jan Klimo
  • 4,643
  • 2
  • 36
  • 42
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
1 answer

Save PDF with Shrine

I'm trying to save pdf files with Shrine. Following Shrine readme, I'm attributing my_model.image = File.open('my_pdf.pdf') but that raises an error: Encoding::UndefinedConversionError: "\xFE" from ASCII-8BIT to UTF-8 How can I acomplish this?…
rwehresmann
  • 1,108
  • 2
  • 11
  • 27
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,405
  • 16
  • 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,157
  • 1
  • 10
  • 21
1
2 3
9 10