Uploading and storing images remotely? - ruby-on-rails

I'm building a rails application where users may want to upload images occasionally. Is there a way to have the users seamlessly upload the images to a remote host, like imgur, and store the URLs to the images in my database so that they can be displayed when needed?
I want to give the impression that they are uploading images directly to the database while actually offloading them to imgur. Is there a gem that does this, or does anybody have a good way to implement this?
Thanks.

Not sure about imgur, but if what you want is simply storing the images on the remote server, I think s3 + paperclip can be a good choice.
aws sdk: http://aws.amazon.com/articles/8621639827664165
paperclip: https://github.com/thoughtbot/paperclip

Using "gem 'carrierwave'" and "gem 'fog'" to upload to Google Cloud Storage or Amazon S3 is probably your best option.
http://railscasts.com/episodes/383-uploading-to-amazon-s3

Related

Use external file storage for heroku app?

I have rails application running on heroku, as heroku file system is read-only so we cannot store any files or images on heroku.
A lot of people has suggested to use amazon s3, but can i use external storage to save user files and images and to retrieve them from there with paperclip or carrier-wave or anything similar.
Currently i am using Dropbox for images and files storage. But its too slow. I have a shared hosting account, there i have a lot of disk space and i want to use that to store files.
Any idea on how to do that?

Mobile upload file to S3 using a Rails Rest API

I have a web app in Rails that has a profile image upload, I`m using Refile gem to upload the photo direct to Amazon S3.
But now I need to do this upload from a mobile app too.
Witch is the best way to do that?
I think about a Rest API in Rails that receives the binary data and then uses Async Jobs (Sidekiq) to upload to Amazon S3, but and not sure if the approach is best way.
Can anyone help me?
Thanks!

Scaling user image uploads on Heroku with Carrierwave

I have a Rails app on Heroku that seems to be having trouble scaling the way I want it to. In the app, a user can upload multiple nested images to an invoice. Based on my research, it seems that this ties up a Heroku web dyno (I'm running 3) until it's done uploading. I've looked into Carrierwave Direct so that a web dyno isn't used but it doesn't seem that this is compatible with a nested model. Does anyone have any other suggestions?
Don't upload images to Heroku. It will lock your entire web server. Instead, use a jQuery library (https://github.com/blueimp/jQuery-File-Upload) to upload directly to Amazon S3 from the client side.

Need advice for image hosting websites

I'm developing my personal photography portfolio using Ruby on rails. I'm not at all saving those images in my assets/images folder as there are many high resolution images which will cost increase in size of the site folder. So i thought to upload those pics on some image hosting websites so that ill only give a URL of that pic which will dramatically cost in decreasing the size of the site folder. Ive three questions regarding my portfolio:
1. Is this the right way to do for portfolio websites?
2. What are the best image hosting websites for such need?
3. On what basis ill use the database for my portfolio?
Thanks.
You should check out some CDN (Content Delivery Network) service like
Amazon S3 + Amazon CloudFront
Rackspace Cloud Files
Cloudinary
Ruby has many gems for managing cloud services like these.
For example:
fog gem (actively developed by guys at Heroku and Engine Yard)
cloudinary gem
carrierwave gem (handles automatic uploading to CDN and database storage)
carrierwave + cloudinary (easy tutorial here)
You could also use Paperclip which can link to AWS as well to store all the images and manage the storage logic as well.
https://github.com/thoughtbot/paperclip

How to upload an image to another server via HTTP post using carrierwave(Ruby On Rails)?

I am trying to upload an image to another server via HTTP post using carrierwave? What I understand so far is, Carrierwave supports some known cloud storage. but, in our application, we have a separate storage system with MongoDB. In order to store any file in that server, we can use HTTP post. Now, I am trying to write a client code to upload image. Is it possible to achieve by using Carrierwave or is there any other gem available?
Thanks in advance.
If you're using CarrierWave and MongoDB, I would use the https://github.com/jnicklas/carrierwave-mongoid gem to connect and store directory in GridFS.
Here's a good post on uploading and retrieving an image via carrier wave and gridfs: http://hafizbadrie.wordpress.com/2011/04/14/image-upload-with-carrierwave-and-mongoid-gridfs-mongodb-in-rails-3/
you need to provide your data where there is s3 data in the tutorials:
stack overflow

Resources