Categories

Building Something beautiful
Posts for Tutorials Category
CarrierWave MiniMagick and Rails 4 Tutorial

CarrierWave MiniMagick and Rails 4 Tutorial

In this tutorial we will create the ability to upload an image, resize an image based on any defined pixels and whitelist file extension types to protect our database.

Let’s add the gems to our gemfile:

[crayon-59c36061a7491718575791/]
 
[crayon-59c36061a74a9556422604/]
 

CarrierWave comes with a generator that will create an upload class. You can generate this by running:

[crayon-59c36061a74b1850780315/]
 

This will generate the following:

[crayon-59c36061a74b8364512040/]
 

Uncomment out the following so it looks like this:

[crayon-59c36061a74c4610377091/]
Here we have done a few things:

Enabled MiniMagic Created a thumb version of the image White labeled image extension types

Lets create a migration...

Welcome to Katharine.org

About Me

Hello - happy to have you stop by my adventure of building beautiful things.


Here I provide tutorials for DIY software projects - from UI Design to Database Design.


Believe in yourself - you can build anything if you put your mind to it.


xo Katharine

Stay Connected

Instagram Feed

×