Uploading image from PhoneGap to Carrierwave / Rails 3? - ruby-on-rails

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/

Related

Uploading Webcam screenshot with Rails 5 ActiveStorage

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!

Rails s3_direct_upload how to disable it

In Rails, I am using s3_direct_upload gem for asset(doc file) upload. Right now if I try to upload an image file as a different asset, it is directly uploading to s3. I need to disable this option for image upload and it should be enable only for document upload.
s3_direct_upload is provides form helper methods to upload images to s3 directly. like this s3_uploader_form. It just reduces your jquery_file_upload and s3 configuration.
But you can still upload image to your local file system. Using simple form_tag. i.e. When you want to upload images to s3 use s3_uploader_form syntax and when you want to upload images to local file system then use simple form_tag or any other rails provided form syntax.
For uploading images using ajax use remotipart gem with simple form syntax.

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

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)

Is there a way to do an Upload Progress Indicator for CarrierWave / Fog?

I'm using CarrierWave / Fog in a Rails application to upload videos to Amazon S3.
Is there a way to determine the progress of the upload, so that I can display
the upload progress being made?
CarrierWave and Fog don't have that kind of functionality natively; you'll need a front-end uploader to display progress stuff. When I had to solve this problem I used jQuery file upload because I already had jQuery in my stack. There's even a post on CarrierWave integration so you can just follow the instructions there to get a progress bar working for your app.
Have a look at this,
https://groups.google.com/group/ruby-fog/msg/45e8f0a63d973a6b

Resources