Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Uploading Images0:52 with Jason Seifer
We already know that we can upload files and attach them to statuses. But what do we do if someone uploads an image that is really big? What we want to do is resize it so that it doesn’t take up as much space on our server as well as have it be formatted to look good on our site.
[Advanced Social Features in Ruby on Rails]
[Stage 2: Creating an Image Gallery, with Jason Seifer]
We already know that we can upload files
and attach them to statuses.
But what do we do if someone uploads an image that's really big?
What we want to do is resize it
so that it doesn't take up as much space on our server
as well as have it be formatted to look good on our site.
As an example, we might want a few different versions
of an image to display on the site.
For example, we'll probably want a really small thumbnail
for the main feed page, a larger version on a gallery page,
and an even larger, or full-size, version on the photo page.
Luckily, Paperclip gives us some shortcuts when working with uploaded files.
Now let's go ahead and implement that.
You need to sign up for Treehouse in order to download course files.Sign up