You’re not receiving notifications from this thread.
File Uploading with Carrierwave Discussion
very helpful!! Thanks!!
if I would like to upload multiple images en this case (book)? Can you create tutorial using carrierwave + nested ?
Many thanks Chris for the tutorials.
Can I use carrierwave for a music site. Users will upload songs to save on a local server and will be able to play songs after upload.
Or please can you advise on the right gem for this.
I would definitely still recommend Carrierwave for uploading songs too. It isn't just for images although that's often the most common example. You can have it work with any file type so this is what you'd want.
I am trying to upload a song to an existing post via 'edit', but It looks like the file is not saving to local server. Please can someone help
<%= song_tag @post.song.url if @post.song? %>
mount_uploader :song, SongUploader
class AddSongToPosts < ActiveRecord::Migration
add_column :posts, :song, :string
As i have seen in most of your videos you have started creating app without rails new appname, can please share me the predefined template so that it will be easy for me to catch up?
Great idea. I don't have a copy yet but I'll do that next episode. It basically is rails new app, install devise, bootstrap-sass and create an application layout that uses bootstrap. Pretty quick / basic and it lets me focus on the topic instead in the videos.
hiyas i have carrierwave in my proyect and i want to multiple upload using only one file_field im already add multiple: true but they ignore all :(
Hello @excid3:disqus , im having undefined method `original_filename' for "Armadillo2.jpg":String
It looks like maybe the filename is getting set as the picture attribute and not the file itself. In any case, are you trying to use my example code of how Carrierwave works behind the scenes or with Carrierwave itself?
Hi All, I can use uploaded avatar in user/show page by adding
<%= image_tag(@user.avatar_url(:thumb) if @user.avatar? %> not a problem.
How can I refer to or use the same user avatar in a user Activities index page as it throws error "undefined method `avatar?' for nil:NilClass"
I tried to add a column; avatar to the Activities table though
You're probably doing a loop in the index page to list all the users, so you'd say "user.avatar_url(:thumb)" instead of "@user". :)
Hey Chris! Do you have any quick wins/ conventions regarding image resizing in carrierwave? At the moment I only use a thumb version with `resize_to_fit [80, 80]` and just realized some of the user profile images uploaded by users are distorted. I checked some rails apps to find an easy solution and basically everybody just uses some kind of combination of `resize_to_fit` / `resize_to_fill` / `resize_to_limit` and doesn't seem to be having any problems with distorted images. Some people are manipulating the images with some heavy minimagick methods, but it seems to be an overkill for me for this purpose. I guess you have some best practices in your apps.
I've been using Gravatars a lot lately so I haven't touched this in a while. Good refresher for me. :)
For avatars, I'm pretty sure resize_to_fill normally works best because it will resize the image to the proper dimensions and then crop from the center so that you get the best square images for it.
process :resize_to_fill => [400, 400]
This would always resize your image to fill a 400 by 400 space and then crop off the edges that are wider. In the case of landscape, it would adjust the height to 400 and then crop the sides out so the image is square. Portrait will do the same just cropping the top and bottom instead.
Chris, to practice I want to build all the little apps you build here. How can I get episode in groups that create a specific app. For example this one with carrierwave started at some previous episode. How do I know where it starts? If 2, 3 , or more episodes build a single app where features are constantly being added, how do I find that group in order?
So I unfortunately didn't do a great job of including the source code or the steps before the examples here. I've been doing a much better job of that lately. Basically this app just had a model called Book which was a scaffold that has a title column and description column. I also added Bootstrap to make it look pretty, but that's not necessary. That should be all you need. I am revamping the site to organize everything in series so you can watch all the related episodes together, but some of these early episodes only focused on a specific piece and didn't include all the setup instructions unfortunately.
Hello @excid3:disqus ,
I have two models portfolio and a blog post both of these model have 1 main_image and 1 thumb_nail image. I read on 'SO' that I need to create 2 uploaders, one for post and one for portfolio. How do I do that?. I am kinda new to rails, any help will be much appreciated.
hi, How do I show an image in the index without carrierwave
I followed your steps without carrierwave and I need to show the image in the index