File Uploading with Carrierwave Discussion
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 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.
Ya i know that. But every time I do for any app it takes time and instead of focusing in real theme i get lost in putting authentication, bootstrap and templates. So it would be better if you create a episode or share GitHub repo of skeleton app you will be using in every video i.e why lot's of people won't get lost in sequence. I told many of my colleagues to learn from your video, they tried but all of them they said about it doesn't cover from basic means from start. Railscast was best because it always start from zero to end and mention every resources. I would request you to integrate in every one of your 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
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
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, for some reason I can't make it work. Perhaps I misunderstood something. Don't you have a github repo with a code example where I can check what I missed?
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.
Also how did you become so great at coding? What is your daily learning routine? Do you study source codes everyday or ...?
Easier said than done, but I have been coding for over 10 years (I started in 7th grade). My routine is usually trying something new at least a few times a week, hopefully daily. I also often try new technologies and compare them to what I know and try to recreate something I know with that. Like React Native vs iOS native swift code for example. Or Python vs Ruby or Django vs Rails. The comparisons help because they give you insight into why the language or framework creators chose to do things the way they did. I'll often read the source code for other apps, but usually it comes down to applying it on a real project. That's why I've got 188 open source repositories on my github. :) https://github.com/excid3?t...
I should do an actual episode on this topic or something. Any specific questions you think would be helpful to answer about my learning method?
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