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.
135
questions
0
votes
1
answer
32
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 "...
1
vote
1
answer
42
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 ...
0
votes
0
answers
23
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 ...
0
votes
0
answers
20
views
Saving without adding a new image removes the existing image. In Rails Administrate Dashbpard with Shrine
I'm using Shrine in my Rails 7 app along with Rails Administrate gem and Administrate field shrine gem.
I can upload an image to my Post in the dashboard, and that works all fine. But when I edit a ...
1
vote
0
answers
357
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 "...
0
votes
0
answers
50
views
Renaming Uploaded Files in Shrine
I need a way to rename already uploaded files in shrine. My project is a drop box like application, where you can create folders and attach files into it.
At some point the user will need to rename ...
0
votes
0
answers
90
views
Shrine throwing image type validation error when I upload the correct image
I am trying to seed my database and for this I need to directly upload images through the code. When i do this the shrine throw a validation error.
For example I want to attach a gif and the uploader ...
0
votes
1
answer
35
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 ...
0
votes
1
answer
29
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/:...
0
votes
0
answers
44
views
Shrine derivatives using original name (ruby, rails)
I'm struggling to get derivatives to display correctly with the original filename.
Long term I'd like the location to be:
[class_name,
identifier,
derivative,
filename
].compact.join("/")
...
0
votes
2
answers
123
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 ...
1
vote
1
answer
55
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) ...
-1
votes
1
answer
26
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 ...
0
votes
1
answer
39
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 ...
1
vote
1
answer
69
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....
0
votes
0
answers
167
views
Shrine derivatives (ruby, rails)
I use Shrine 3.4 for my rails project (ruby 2.7 and rails 6.1). When I use derivatives plugin then image_url(derivative) returns default url.
My code:
In my config I define file storage and plugins.
# ...
0
votes
1
answer
76
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)
...
1
vote
1
answer
133
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 ...
0
votes
1
answer
31
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 ...
0
votes
2
answers
161
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 ...
1
vote
0
answers
61
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 ...
0
votes
0
answers
267
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::...
1
vote
0
answers
69
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 ...
0
votes
1
answer
177
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 ...
0
votes
1
answer
171
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 ...
1
vote
1
answer
64
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 ...
0
votes
1
answer
411
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 ...
0
votes
1
answer
303
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 ...
0
votes
1
answer
35
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 ...
0
votes
1
answer
428
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('...
1
vote
1
answer
611
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 ...
2
votes
1
answer
464
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)...
0
votes
1
answer
122
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 '...
2
votes
3
answers
507
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 ...
0
votes
1
answer
452
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 ...
0
votes
1
answer
540
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 ...
0
votes
2
answers
380
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 "...
1
vote
0
answers
304
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::...
0
votes
1
answer
41
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 ...
1
vote
0
answers
332
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 [...
1
vote
1
answer
444
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/...
1
vote
0
answers
265
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 ...
1
vote
1
answer
158
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
# ...
0
votes
1
answer
950
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 ...
1
vote
1
answer
198
views
Ruby/Rails - Shrine::Error (storage :store isn't registered on ImageUploader)
For the last days, I'm trying to add a new storage config for my application, so we can use Cloudinary for images and Digital Ocean Spaces for other files.
And after the changes I supposed were needed ...
0
votes
1
answer
1k
views
Module not found: Error: Can't resolve 'cropbox' 2
I asked question Module not found: Error: Can't resolve 'cropbox'
But I didn't get an answer, so I have to focus on more specific issues and searching in StackOverflow,
So that I get ...
2
votes
2
answers
646
views
New to Shrine. What is the use of the cache?
I'm currently using Shrine to upload files to DigitalOcean (via s3 sdk). It works nicely, it's perfect. However, in the guide there's a storage option to make a temporary copy of the uploads, ...
0
votes
0
answers
798
views
How to use the cropperjs in rails.6.0.2
I implemented cropper js with the shrine gem,
I refer to https://github.com/shrinerb/shrine/wiki/Image-Cropping,
And this codes https://github.com/shrinerb/shrine-crop-example/,
But doesn't work it,
...
0
votes
1
answer
753
views
ActionView::Template::Error (undefined method `image_url' for #<ActionView::Helpers::FormBuilder:0x00007f921c2ac9b0>)
I'm using the shrine gem in form object,
I want to clip images, so, I followed https://github.com/shrinerb/shrine/wiki/Image-Cropping,
but, happed above error,
I think that it seems to be don't ...
0
votes
1
answer
181
views
Unpermitted parameter: :photos_attributes
I want to use shrine gem in nested form,
But happened
Unpermitted parameter: :photos_attributes
How to solve it?
I tried some ways, that
def blog_form_params
params.require(:blog_form).permit(:...