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
0
votes
1 answer

Image_Processing - MiniMagic - Shrine different quality for every derivatives

Is there some way to set different quality for every created image? And of course leave original file with quality 88 image_uploader.rb require "image_processing/mini_magick" class ImageUploader < Shrine Attacher.derivatives do |original| …
Wordica
  • 2,427
  • 3
  • 31
  • 51
0
votes
1 answer

Shrine validation of file extension does not allow Facebook image

I'm using Srhine for images in my project and Omniauth gems for logging via Google and Facebook. My method of getting data from Omniauth provider is the standard one: def self.from_omniauth(auth) where(provider: auth.provider, uid:…
bochen421
  • 161
  • 3
  • 14
0
votes
1 answer

Getting FB profile photo with Shrine

I'm using Devise for authentication in my project and I'm having troubles getting the image when logging through FB with Shrine gem. I have standard devise method to get data from Omniauth provider in user model: def self.from_omniauth(auth) …
bochen421
  • 161
  • 3
  • 14
0
votes
2 answers

Rails and Shrine create model record with attachment

I need to upload image with Shrine using uploader, I have default uploader from example here including few derivatives. Like here https://shrinerb.com/docs/getting-started But I want to create new instance inside IRB, and I don't figure it out how…
Levi
  • 77
  • 7
0
votes
0 answers

converting strings into an ActionDispatch::Http::UploadedFile object in Rails

Uploading a file the Rails way looks like this in console: Started POST "/onboard/add_doc" for 2600:1700:ba00:3970:1900:ab4c:b842:8b5c at 2021-03-13 12:42:47 -0800 Processing by Users::DocsController#create as HTML Parameters: {"utf8"=>"✓",…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
0
votes
1 answer

Shrine::Error (storage :store isn't registered on ImageUploader)

The subject says it all. I’m using shrine with a photos model. When I upload file, the create action throws this error Shrine::Error (storage :store isn't registered on ImageUploader) I looked it up and everyone is saying to change the name of the…
Wes Creations
  • 337
  • 2
  • 10
0
votes
1 answer

Resize not working with Shrine and ImageProcessor / MiniMagick - Rails 5.2

I am trying to use ImageProcessor / MiniMagick to resize images before they are saved to the database of my Rails 5.2 app. I am able to save the image, but this image is not resized before saving and there is no error thrown. I'm also using Trix to…
gbutters
  • 213
  • 2
  • 15
0
votes
1 answer

setting mime type for image files before they are encrypted with Shrine and Rails

My app encrypts and uploads certain files, and then makes them visible to admins. To achieve the latter functionality, my encryption gem's documentation suggests a controller action that looks like this: def show user = User.find(params[:id]) …
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
0
votes
1 answer

undefined local variable 'image' for Class

I would like to encrypt a file before storing it on S3. I'm using Shrine for uploads, and Lockbox for encryption. Shrine#upload takes an IO-like object, but the Lockbox documention excludes some steps that are needed for setting this up. It simply…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
0
votes
1 answer

Uncaught TypeError: Cannot read property '1' of null?

I'm getting an error: Uncaught TypeError: Cannot read property '1' of null. What does this mean? The source of the error is the line that says id: file.meta['key'].match(/^cache\/(.+)/)[1]: uppy.on('upload-success', (file, response) => { //…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
0
votes
1 answer

undefined method `each' for #

In my view I have this: <% @item.images.each do |image| %> <%= image_tag image.images_url(:large) %> <% end %> If I have one image uploaded, it returns the error undefined method 'each' for #, but…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
0
votes
1 answer

Shrine derivatives plugin method :image_derivatives! error undefined method 'bytesize' for Array

Thank you for any and all help! I am attempting to create derivatives for an image that is uploaded in a Rails controller action. To start, I installed imagemagick and vips with homebrew: brew install imagemagick brew install vips I have the…
0
votes
1 answer

Shrine Gem Ruby on Rails Serverless Image Handler, Background Job

I'm using the Shrine Gem to process files in my Ruby on Rails project using S3 multipart upload. I want to use the Derivatives plugin to point to a AWS Lamdba serverless image handler as my derivative remote_url, and process these derivatives in a…
Dylan Fisher
  • 316
  • 3
  • 8
0
votes
2 answers

Undefined method `image' in Shrine

I try to add Shrine gem to an existing project that uses Paperclip. I added a Shrine image to a new model (just for a check). So I created model Country with this db table: create_table "countries", force: :cascade do |t| t.string "name" …
taneko
  • 41
  • 6
0
votes
1 answer

Where should I put shrine image_uploader file?

I'm using shrine for image uploading in my project. I'm trying to follow this guide: Getting Started/Eager Processing I am not sure where should I put image_uploader.rb in my project. FYI, here is the code for image_uploader.rb: require…
glinda93
  • 7,659
  • 5
  • 40
  • 78