File system for carrier wave - ruby-on-rails

I have been looking at carrier wave for image uploading for a website I am creating. I have heard good things about carrier wave and same with paper clip.
What I can't seem to find information on is how either gem handles its file system. Do you I need to get a plugin to make a fast query-able file system? Were these gems(specifically carrier wave) desgined to handle a large amount of users posting pictures and if so how do they save the files?
One option that I will probably use is severin's answer at the very bottom of this link.
However if these gems already have a good file system implemented then there isn't a point in over complicating things, just need some input from you guys on the matter.

I used Paperclip with Rails 2 and switched to Carrierwave when migrated to Rails 3.
Both of these solutions write the files to the public folder with a similar folder structure.
Carrierwave also has another nice gem "Carrierwave direct" which allows to upload to a remote server or S3 directly from the user browser, which is nice for scaling. It is also a requirement when using Heroku which doesn't have a file system (or didn't have one available prviously)

Related

configure paperclip to generate styles when they are requested

I need a user to upload an original file and process that into a thumbnail (paperclip's got this - check).
Then I would like to be able to retrieve different styles for that attachment, but I do not need to store those different styles on disk anywhere. I would prefer they are generated during the request.
The reason for that is that these styles are single-use. So, paperclip becomes a glorified one-time-use image resiszer. I'd prefer not to incur the S3 cost if I don't have to.
Wondering if there'a way to do this out of the box. Or, maybe carrierwave supports something like this?
Thanks!
I'm pretty sure that the Refile library supports it. Refile is basically a modern version of the Carrierwave, written by the same author.
You can read more about the on-the-fly processing here:
https://github.com/refile/refile#processing

Using cloud storage for images in a Ruby on Rails app

I have been struggling with an efficient way to store and manage the pictures I need in a Ruby on Rails app I am building. I will use a real estate app as an example:
In my real estate app I have a House model and a House controller. On the House #show page I want to list information on the house as well as display pictures for that particular house. Some of the houses have five pictures, others have one. What is the best way to store these pictures and display the ones that pertain to that particular house?
Obviously I do not want to store them with the app, that would be way too bulky. I have tried using Amazon S3 buckets and the Amazon SDK but was unable to get it up and running. Amazon's documentation is all over the place. I currently have pictures stored in a Google Cloud Storage Bucket. They have a public link so an individual image is easy to display. The problem lies in the fact that each house might have a different number of pictures associated with it.
Google's documentation is difficult to navigate, especially when it comes to Ruby. If there were an easy way to access my bucket and filter the files stored there, this would be a breeze. Any ideas? Does anyone know how to do this in Ruby? This type of photo storage is very common and I am surprised at the difficulty I've had in getting it set up. Thanks for your help.
Amazon S3 is one of the best options out there, but it can be a little confusing. Try the paperclip gem for adding file associations to your models.
It gives you multiple options for how to store files and makes it easy.

What are my options for resizing an image in my rails application?

I would honestly appreciate feedback, or an on edit, on what I should change about this post instead of all the down votes. I'm new to web development, and I had an honest question. If this isn't the place to ask it, please point me in the right direction.
I have a Ruby on Rails application where part of the core purpose involves displaying images that I pull from the Facebook Graph API. And I want to be able to display the images in a uniform size.
What I'm hoping I can do: I'm trying to just store the id of the image from Facebook to my database and resize the image after I pull it from Facebook's servers. I was thinking that this would save on storage costs. I've been looking at the RMagick gem that binds Ruby to the ImageMagick library, specifically their resize method.
Another option I've considered: I'm thinking about adding a cropping feature. To do this though, I think I would need to set up a storage service, like Amazon's S3. Then I would pull from the image storage service where the cropped images are stored instead of pulling from Facebook and resizing client-side.
Are there any options I might not be considering? And how accurate are my examples to approaches that could be taken.
If you have a huge number of images to show, then go with "resize - store - show". If less then go with an on-the-fly process.
Here are a few well-known gems that help you process images, but choose according to your requirement:
CarrierWave
Paperclip
Dragonfly
refile (new gem)
See "Compare CarrierWave ,Paperclip and Dragonfly in rails" and "Refile: Fixing Ruby File Uploads".

Uploading directly to S3 and resizing the images

I'm using s3_direct_upload to directly upload images from my rails app to an S3 bucket. This is all working fine, however now I'd like to resize the images once uploaded, creating a thumbnail and various other versions.
The approach I can think of taking is using the URL that's posted back from s3_direct_upload to then create a new object in my app in the background, process using RMagick and then reupload these versions to S3. However, this approach feels like the initial upload becomes a little redundant.
Any advice on this or a better approach would be greatly appreciated.
Updated Answer
You mentioned in a comment to my original answer that you'd tried CarrierWave. But...have you tried out CarrierWaveDirect? I haven't used it myself, but it appears to perform the same S3 direct-uploading, with the familiar API of CarrierWave.
Original Deprecated Answer
You'll probably want to look into either Paperclip or Dragonfly. They each support uploading images to S3 (or other cloud storage provider), and also provide features for manipulating the images. The two solutions handle manipulations in different ways--Paperclip performs thumbnailing at upload-time, whereas Dragonfly performs thumbnailing on-the-fly--but either should meet your needs.

Creating a Rails Music Player App (something like Rdio)

i want to create a rails app that has a lot of mixtapes, which the user can listen to and download (like datpiff.com). All the mixtapes would be uploaded by me. Each mixtape would have their own page, with the title, artist name, cover, etc.
I'm having trouble getting the architecture of the app right. What's the best way to upload all the mixtapes. (I'm thinking something like Amazon S3).
Do I have to upload a zipped file with the entire mixtape, and each individual song, or just the zipped file.
How do i show the information of each song (title, length, etc)
Ofcourse the biggest problem is the streaming of the mixtape, and the download of the file.
Can anyone guide me as to whats the best way to create this app. (Is Rails the best way to do it?)
Thanks in advance.
You're on the right track with S3. Use paperclip in conjunction with it if you want to make some sort of GUI for you to upload stuff with.
For streaming check out jPlayer, which is a jQuery plugin.
Download's no biggie. Check out Rails' send file. For sending from a remote source like S3, look here.

Resources