rebranding rails application - ruby-on-rails

I would like to rebrand my Rails app so that each user will have their own configuration like CSS, logos etc. We are storing the logos and fav icons in Amazon S3. Please let me know what is the best way to retrieve as if i retrieve from their for every request that will cost me lot of bandwidth because every page will have logo and the fav icon. I am looking for a most economic way of storing those images.

You could download the logos running wget within RoR, telling the application to store it on a special folder.
But, the best way to save bandwidth would be directly linking the logos and favicons that are in Amazon S3.

Related

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.

Storing images not as part of app

I am building my new site and have a small group of images I want to display on the site.
They are not images to do with styling so it feels wrong to store them within the app/assets directory
I don't wish to put them on my Flickr account which builds by apps gallery as they are not that type of image.
I currently have them stored on an Amazon S3 bucket and link to them from there.
is there a better way. What way would you guys choose?
If I am already using the best way, is it worth linking to them using the standard url Amazon provides me with or should I direct one of my URL's to that point?
Your choice for Amazon S3 seems fine to me, and no, you should not change the standard URL's Amazon provides you with. Advantage is that your own web server is not bothered by the image URL's anymore!
I have a similar website storing "dynamic" pictures, and I keep them on cloudinary, which is a similar site. Your source directory should not in general store these "dynamic" pictures. They only consume disk space, and sites like Amazon S3 and Cloudinary are made just for that!

Is it OK to use Twitter and Facebook profile images without storing them in my server?

Currently I'm using Facebook connect and Twitter oauth to authenticate users. and I'm using their profile image urls directly instead of storing them on my server. I guess it's better to save the thumbnails and think eventually may need to do that, but for now am trying to save as much money as possible. (I'm currently using Heroku to host my project and can't store files unless I use S3 or the likes, which would cost me money)
I'm wondering if this is OK, and if most web apps start out this way. Or if I need to store the images.
Also, now I want to let users set up accounts without Twitter or Facebook. In this case, is there a way to use a "third party thumbnail hosting site" (I don't even know if such a thing exists) for free instead of using S3? It can even be a short term hack, since I plan to eventually implement image storage if this gets traction.
I think not storing them is the best way. If someone changes their picture, you always show the latest this way, if you stored them, well then you would have an old version of their picture after time which could make your app look stale.
As for where to store alternatives, I would really consider s3. It is very cheap storage, and thumbnails won't need a lot of space. It would only get expensive if you had a LOT of users, and if you have a LOT of users, you should be able to afford the storage.
Also, have you looked at Gravatar? A lot of people have those linked to their email addresses, it might be another good way to get their picture. http://en.gravatar.com/site/implement/

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.

Which is the best route to take when uploading images from my Rails app to Amazon's S3?

I have a web app in which users can upload an avatar under 700kb. That's the only part of the application dealing with uploading images (so I won't be dealing with an exceptionally heavy load). I was wondering what the best way is to go about this. Currently I'm using Paperclip and I wan't to store all of the images on Amazon's S3.
Option 1: User uploads the image to my web server. The image is processed asynchronously using delayed job and is then uploaded to s3. The image is then deleted off of my web server.
Option 2: User uploads the image directly to s3. A background process on my web server downloads the image, processes it, and uploads the newly created thumbnails to s3.
Option 1 seems to use less bandwidth overall. Option 2 seems to save my application the resources of having the image uploaded directly to it.
Am I correct in these assumptions? Which option is the fastest and most resource-friendly? Or is there another way to go about this?
Also, I was wondering if sites like Twitter, FB, and Posterous asynchronously process images. Whenever I upload a profile pic on Twitter, or images on FB and Posterous, they seem to be processed instantly.
Thanks!
Tim
Your best bet is to have the user upload directly to S3. The d2s3 plugin works well for this.
In your d2s3 callback, create a delayed_job event to download the full size images and save thumbnails them to S3 with Reduced Redundancy Storage. If you wire everything up correctly, you can automatically generate thumbnails when and if they're ever lost from S3.
If by "processing image", you mean creating thumbnails or other image conversion options, you can do that using paperclip. If processing is a huge task that can't be achieved using paperclip alone, then I would go with option 1, cheaper as you don't access S3 multiple times. Just make sure you have enough hard disk space for all images during processing.
If you end up going the route of uploading directly to S3 which offloads the work from your Rails server, please check out my sample projects:
Sample project using Rails 3, Flash and MooTools-based FancyUploader to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-FancyUploader
Sample project using Rails 3, Flash/Silverlight/GoogleGears/BrowserPlus and jQuery-based Plupload to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-Plupload
By the way, you can do post-processing with Paperclip using something like this blog post describes:
http://www.railstoolkit.com/posts/fancyupload-amazon-s3-uploader-with-paperclip

Resources