Uploading Webcam screenshot with Rails 5 ActiveStorage - ruby-on-rails

Like the new ActiveStorage functionality in Rails 5.2.
My app let's the user take a still form their webcam, which I then need to upload as an attachment.
Does anyone know how to do this with ActiveStorage?
My setup accesses the webcam via JS using navigator.mediaDevices.getUserMedia and copies a still to an image tag via a canvas. I've tried uploading the data from the img tag to ActiveStorage, but either ignores it or gives a signing error.
Any ideas if this is possible and how it could be done??
thanks!

Related

Vue Js & Rails: How to display image attached with blob

I'm uploading image files using Rails Active Storage gem and they are being hosted in AWS S3. However, I wonder how could I display the image attached to each record in my Vue Js component. I have tried to directly call the image file name but it did not work; Also, I tried to use the AWS image_url but after some time I realized that it was an incorrect approach. What would be your suggestions to accomplish this?

Processing file before upload using ActiveStorage

How would I process a file before it's uploaded using activestorage. I need to be able to modify an svg file's content before it actually gets uploaded to S3. Can't seem to find any callbacks.
There is no way to do this natively with ActiveStorage. It's the major drawback with using ActiveStorage.
As far as I know, the only way to modify an upload is to create a variant of the original upload after it is created...which creates a (completely different) variant image based on the image that was originally uploaded.
ActiveStorage is easy to setup but, after using it with a few applications, Carrierwave..etc seem like better options.
In addition, if you want to upload in a background job, ActiveStorage is a pain.

Cloudinary with rails won't show my picture

I am developing a Rails application and I want to upload a picture directly from my browser using Cloudinary.
I followed all steps from the Cloudinary page and ended up with a box and a question mark after I "uploaded" it, no picture at all. Any ideas what might be the problem?
I am not sure what you have used. But you should use carrierwave with cloudinary. Cloudinary having some complex way to handle display and save image if you don't use carrierwave.
But carreirwave provide simpler way to achieve uploading and display image.
Without using carrierwave
Using carrierwave in compbination
You should try the sample project and then check the differences:
https://github.com/cloudinary/cloudinary_gem/tree/master/samples/photo_album

Uploading image from PhoneGap to Carrierwave / Rails 3?

I'm trying to figure out the best way to upload a camera image from a PhoneGap app to a Rails 3 app that has Carrierwave on it. My thoughts so far:
Option 1) Use phonegap filetransfer functionality to upload to a temp folder on S3 then assign the URL to the remote_avatar_url for my carrierwave field. Then carrierwave does all the work for me in terms of grabbing the image, resizing, cropping, etc. Carrierwave will then send the files back over to S3 where they will be stored in the right places.
Option 2) Use phonegap filetransfer functionality to upload directly to my rails server then let carrierwave do the work from here. This seems more efficient, but I don't know how to assign an image that was posted to a rails api controller to Carrierwave so that it can do its thing. Any ideas assuming this is the best way to handle?
Thanks!
You can send the image as Base64/encode and than parse it on the CarrierWave side. Take a look at http://ograycoding.wordpress.com/2012/07/03/api-upload-with-carrierwave/

Carrierwave multi file (photo) upload

I have Ruby on Rails app and I use Carrierwave for uploading my images, but I need upload more than one image at a time. I find some jQuery plugins(uploadify, image-uplad) but I don't know how implement it to my app. I don't need a huge app/engine for it.
Check it : http://lucapette.com/rails/multiple-files-upload-with-carrierwave-and-nested_form/
Uploading multiple files at once to Rails app with Carrierwave (HTML5)

Resources