Recent Posts




css color art

Papaya Whip 3 Ways


Categories

Building Something beautiful

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:

 

 

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

 

This will generate the following:

 

Uncomment out the following so it looks like this:

Here we have done a few things:

  1. Enabled MiniMagic
  2. Created a thumb version of the image
  3. White labeled image extension types

Lets create a migration for pictures in Post:

 

Next, we need to add this to the Post class:

 

Let’s add this to our post#new view:

 

To view the image on the post, add this to post#view

 

Comments Off

You may also Like

Custom Markers with Ar.js

Custom Markers with Ar.js

November 24, 2017

Welcome to Katharine.org

About Me

Hello - Thanks for stopping by :).


I am working on Web Augmented Reality at Code to Canvas.


Code to Canvas

Stay Connected

Instagram Feed

×