/autoform-cloudinary

Easily upload images to Meteor using Cloudinary and Simple Schema

Primary LanguageJavaScript

About

This package lets you use Cloudinary with autoform/simpleschema to easily upload an image to your Cloudinary account, and it automatically saves the url for the image using autoform.

Usage

  1. meteor add cosio55:autoform-cloudinary

  2. Set up settings.json file

{
  "public": {
    "CLOUDINARY_API_KEY": "[YOUR API KEY]",
    "CLOUDINARY_CLOUD_NAME": "[YOUR CLOUD NAME]"
  },

  "CLOUDINARY_API_SECRET": "[YOUR API SECRET]"
}
  1. Create collection and attach simple schema
Images = new Mongo.Collection('images');

Images.attachSchema(new SimpleSchema({
  image: {
    type: String,
    autoform: {
      afFieldInput: {
        type: 'cloudinary'
      }
    }
  }
}));
  1. Create quick form
<template name="imageForm">
  {{> quickForm collection="Images" type="insert" id="add-image"}}
</template>
  1. Run meteor

meteor --settings settings.json