As of May 31, 2023, we have updated our Code of Conduct.

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

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 ...
Aurel's user avatar
  • 21
0 votes
1 answer
26 views

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 ...
Nezir's user avatar
  • 6,637
0 votes
0 answers
21 views

Sinatra Upload multiple files with associated model

i'm trying to make a image gallery with sinatra but a thing that should be simple task is confusing and has a lack of doc and tutorial about it! So please can someone give a light about this? for ...
jjplack's user avatar
  • 95
0 votes
0 answers
120 views

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 ...
Doug's user avatar
  • 1,518
0 votes
0 answers
29 views

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 ...
hardow2011's user avatar
0 votes
0 answers
112 views

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 ...
Cinta's user avatar
  • 443
0 votes
1 answer
74 views

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 ...
Mike Vallano's user avatar
0 votes
0 answers
88 views

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 ...
Kobius's user avatar
  • 664
0 votes
0 answers
62 views

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 ...
Wiktor Wrona's user avatar
0 votes
1 answer
28 views

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 ...
R. Sierra's user avatar
  • 985
0 votes
0 answers
531 views

You can only upload in uppy

Eventually I want to implement image cropping wiht shrine and uppy At first I implement upload system with shrine gem and uppy library But I got above errors I refer to Uppy officials site and shrine ...
Mick mic's user avatar
0 votes
1 answer
217 views

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 "...
Kobius's user avatar
  • 664
1 vote
1 answer
191 views

Testing Shrine gem return error undefined method `set_derivatives'

I am trying to test uploads through Shrine. I have Minio and followed this tutorial https://shrinerb.com/docs/testing#test-data Yet FactoryBot.lint returns the following error from the TestModule code ...
Maxence's user avatar
  • 1,899
1 vote
0 answers
108 views

Shrine - How to prevent Shrine from auto uploading files prior to validation - Ruby Upload Gem

This question is for anyone who has experience with the Ruby Gem Shrine for File Uploads. I am trying to scan file uploads for viruses using ClamAV. The scan works well however the file is already ...
Aadhi Vive's user avatar
1 vote
0 answers
972 views

Dockerized Minio for local use not accepting files

I would like to use Minio locally to replicate an S3 like storage. Installed through docker : sudo docker run \ -p 9000:9000 \ -p 9001:9001 \ --name minio1 \ -v ~/minio/data:/data \ -e "...
Maxence's user avatar
  • 1,899
0 votes
1 answer
68 views

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 ...
Dan's user avatar
  • 1,263
0 votes
1 answer
45 views

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/:...
Jason Logsdon's user avatar
1 vote
2 answers
401 views

Problem with URLs for thumbnails created using Shrine plugin on Rails 6

I have been struggling with this for a couple of days and hoping someone can help. There may be something obvious that I am missing! I am using Shrine plugin for Rails to upload PDF files and ...
user1851592's user avatar
1 vote
1 answer
166 views

Converting GIF to JPEG with Shrine and MiniMagick

I have this project in ruby on rails and recently I changed the upload image functionality to Shrine. I want be able to upload an animated gif and then create an static jpeg (or gif if it's easier) ...
CAIO WANDERLEY's user avatar
-1 votes
1 answer
112 views

Can someone provide an example of shrine/rails with multiple images?

my rails app has an model named listing and for a listing i need to upload multiple photos. so the Photo model also has a position so i can order them. trying to do this with shrine despite all the ...
Peter Van de Put's user avatar
0 votes
1 answer
160 views

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 ...
Wordica's user avatar
  • 2,383
1 vote
1 answer
212 views

Rails 6 - Shrine - ImageProcessing - Get Original Uploaded file

This is my image_uploader.rb require "image_processing/mini_magick" class ImageUploader < Shrine Attacher.derivatives do |original| magick = ImageProcessing::MiniMagick....
Wordica's user avatar
  • 2,383
0 votes
1 answer
139 views

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) ...
bochen421's user avatar
  • 153
1 vote
1 answer
251 views

Rake task for migrating from ActiveStorage to Shrine

I've got a Rails 5.2 application using ActiveStorage and S3 but I've been having intermittent timeout issues. I'm also just a bit more comfortable with shrine from another app. I've been trying to ...
tquill's user avatar
  • 269
0 votes
1 answer
39 views

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 ...
bochen421's user avatar
  • 153
0 votes
2 answers
381 views

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 ...
Levi's user avatar
  • 77
1 vote
0 answers
98 views

Shrine attachment blocks devise confirmation email sending

I'm using Shrine gem to allows user upload their document in devise registration form. There is a strange issue as below: If no file is attached to registration form, confirmation email is sent ...
Tiktac's user avatar
  • 966
0 votes
0 answers
617 views

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::...
calyxofheld's user avatar
  • 1,438
1 vote
1 answer
160 views

How to maintain the background transparency when using MiniMagick to resize?

I am using the ImageProcessing gem in combination with MiniMagick and Shrine. When I use the method resize_to_limit!/2 the resulting derivative has a black background when the original image has a ...
asnyder002's user avatar
0 votes
1 answer
341 views

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 ...
Wes Creations's user avatar
0 votes
1 answer
306 views

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 ...
gbutters's user avatar
  • 213
1 vote
1 answer
119 views

Rails 6 shrine image_tag is broken but open in new tab is not

Started up a brand new Rails 6 app with Shrine, everything is fresh out of the box following along with the getting started guide. Got the file uploaded successfully but on the show page the img tag ...
Justin Funk's user avatar
0 votes
1 answer
707 views

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 ...
calyxofheld's user avatar
  • 1,438
1 vote
1 answer
534 views

how would you validate an uploaded file's mime_type in Rails controller?

I'm encrypting my Shrine file uploads in a controller action, and need some way of validating their mime types before doing anything else. Shrine's validation plugins are great, but they do not work ...
calyxofheld's user avatar
  • 1,438
0 votes
1 answer
86 views

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 ...
calyxofheld's user avatar
  • 1,438
0 votes
1 answer
617 views

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('...
calyxofheld's user avatar
  • 1,438
2 votes
1 answer
935 views

rails file_field not showing

I would like to make my app upload multiple files with Shrine, but one doc suggests two file_fields whereas the other suggests only one. After posting a question to their discourse forum, it was ...
calyxofheld's user avatar
  • 1,438
3 votes
1 answer
888 views

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)...
Kobius's user avatar
  • 664
0 votes
1 answer
260 views

undefined method `each' for #<ImagesUploader::UploadedFile:0x00007f8a0f0c0760>

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 '...
calyxofheld's user avatar
  • 1,438
2 votes
3 answers
700 views

Shrine gem - how to prevent deletion of uploaded files from S3

I'm using shrine gem for storing images in S3 by Ruby on Rails. How can I make shrine behave as follows? 1. When uploading files from Frontend, they are stored in S3. 2. When deleting files from ...
batch's user avatar
  • 135
0 votes
1 answer
651 views

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 ...
Alexander Dewhirst's user avatar
0 votes
1 answer
649 views

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 ...
Dylan Fisher's user avatar
0 votes
2 answers
622 views

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 "...
taneko's user avatar
  • 41
1 vote
0 answers
428 views

How to use Upload Endpoint plugin in Shrine?

I want to use the shrine gem, I read a Shrine image cropping , Shrine Upload Endpoint plugin, then I refer to sample codes, First, I copied sample codes, but I happened ActionController::...
Mick mic's user avatar
0 votes
1 answer
67 views

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 ...
glinda93's user avatar
  • 7,359
1 vote
0 answers
422 views

How to get a photo cache data with shrine

I want to use the shrine gem with cropper js, I read a Shrine image cropping and refer to sample cods, First, I copied sample codes, but I happened ActionController::RoutingError (No route matches [...
Mick mic's user avatar
1 vote
1 answer
663 views

rails How to get image name instead of hash for shrine url

Currently when I store any image using shrine uploader then I received url :- /uploads/store/90bcb5a78ed5de16a6c62eea1fb80ed1.png but I want url to be display like:- /uploads/store/...
Adwait soni's user avatar
1 vote
0 answers
363 views

Shrine image preview doesn't appear in nested form

Previously, I asked ActionView::Template::Error (undefined method `image_url') Then, I solved the error But doesn't appear images, It seems to be don't recognize photos_attributes object or couldn't ...
Mick mic's user avatar
1 vote
1 answer
210 views

Rails 5.2 Shrine and Tus server: Cannot create a custom folder structure to save files

I am using rails 5.2, Shrine 2.19 and tus server 2.3 for resumable file upload routes.rb mount Tus::Server => '/files' model, file_resource.rb class FileResource < ApplicationRecord # ...
Abhi's user avatar
  • 3,301
0 votes
1 answer
1k views

ReferenceError uppy is not defined

Error image I implement shrine gem with cropperjs and uppy in rails, I refer to Usage of shrine Image Cropping and Example code Then I implemented code, seemingly code is correct, But I got some ...
Mick mic's user avatar