Rails 6 - Shrine - ImageProcessing - Get Original Uploaded file

Wordica

This is my image_uploader.rb

require "image_processing/mini_magick"

    class ImageUploader < Shrine


    Attacher.derivatives do |original|
        magick = ImageProcessing::MiniMagick.source(original).saver(quality: 88)
        # generate the thumbnails you want here 
        { 
         thumb:  magick.resize_to_fill!(150, 150),
         medium: magick.resize_to_fill!(500, 500),
         large:  magick.resize_to_limit!(800, 800),
        }
    end


end

Question is simple but I can't find answer is Shrine docs. How can I get original photo ? In Rails 4 it was simple, I just ask for image_url(:original)

SOME TRICK:

I read about mini_magic and add something like this

 original: magick.resize_to_limit!(20000,20000),

Image won't be changed if do not exceed 20000x20000 dimensions ...

Denny Mueller

Haven't used shrine in a long time...

How about a simple

@image.image_url

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Render a Markdown file stored in S3 uploaded with shrine - Rails

uploaded file differ with the original

I Have A Problem In Laravel File Upload. How To Get Original Uploaded File?

Accessing original name of file uploaded as a file parameter

Shrine.rb - How to access the file path / raw file after it's been uploaded

Rails CarrierWave: Uploaded file is not saved

Read uploaded JSON file in Rails

Rails - Reading uploaded text file

I get different file size from the original file when I download a file that I have uploaded to Google Drive in React Native

How to GET a file uploaded from a form to get displayed to another view using Rails?

get the data of uploaded file in javascript

How to get path to the uploaded file

Get path of file uploaded to Flask

Get DownloadURL from an uploaded File

Get an uploaded file and show to download

How to get uploaded file in views?

Get blob of uploaded file by filepond

Upload to Rails Shrine from NativeScript

unknown attribute: uploaded_file - Rails 4

How to associate an uploaded file with signed url to the original request

Preserving original time stamp of uploaded file in Azure Blob Storage

Small file get uploaded but not large file in Laravel

Get the file size of the uploaded file in Django app

How to get the file extension of file uploaded

Handling File Uploads from Mobile Application to a Rails End Point using Shrine

Carrierwave: convert an uploaded PNG to JPG by replacing the original version (or: having versions with a different file format than original file)

Get uploaded KB/MB value of uploaded file field in umbraco

File doesn't get uploaded in folder php

Get filename of failed uploaded file in laravel 5.4

TOP Ranking

HotTag

Archive