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.
-
meteor add cosio55:autoform-cloudinary
-
Set up settings.json file
{
"public": {
"CLOUDINARY_API_KEY": "[YOUR API KEY]",
"CLOUDINARY_CLOUD_NAME": "[YOUR CLOUD NAME]"
},
"CLOUDINARY_API_SECRET": "[YOUR API SECRET]"
}
- Create collection and attach simple schema
Images = new Mongo.Collection('images');
Images.attachSchema(new SimpleSchema({
image: {
type: String,
autoform: {
afFieldInput: {
type: 'cloudinary'
}
}
}
}));
- Create quick form
<template name="imageForm">
{{> quickForm collection="Images" type="insert" id="add-image"}}
</template>
- Run meteor
meteor --settings settings.json